Focus and keyboard
Every TILE control works from the keyboard, and shows where the focus is with the same ring. Most of this comes with the components. This page says what you can expect and what you need to keep intact.
On the web, a <button> takes focus and answers Enter and Space with no code. A menu, a toolbar or a dialog that you
build from <div> elements gets none of that, so you write the key handlers and move the focus yourself. TILE’s
components do this work for you.
One focus ring. The focus ring is the ring a control draws while it has the focus. It is
--dx-focus-ring-width wide and takes its color from --dx-focus-ring-color, which defaults to the theme’s focus
token. The ring shows on :focus-visible, so it appears when the user moves by keyboard and not after every click.
Tab moves between groups, arrows move within one. A toolbar, a menu, a radio or toggle group and a list are each one tab stop. Inside, the arrow keys move between items.
To try it, tab into one of the toolbars below, then press the arrow keys. They are the three toolbars from Density and sizes, and each is one tab stop.
Overlays hold focus. An overlay is a component that TILE draws above the page. A dialog moves focus into itself when it opens, keeps Tab inside, closes on Escape, and returns focus to the element that opened it. A menu does the same, and closes when an item is chosen.
A tooltip never takes focus. It shows while its trigger is focused or hovered.
Behavior
Section titled “Behavior”Toolbar.Rootwraps from the last item to the first by default. Passloop={false}to stop at the ends.Toolbar.Root disableddisables every control in it.- A button with
iconOnlystill has an accessible name. The name is itslabel, which is also its tooltip. Input.CheckboxandInput.Switchtakelabel, oraria-labelwhen there is no visible label.
Limits
Section titled “Limits”- An element with
outline: noneor aclassNamesthat hides the ring loses the only sign of focus. Keep the ring. - A custom control placed in a toolbar joins the arrow-key order only if it is a TILE control or reads the toolbar’s
item context. A plain
<button>is a separate tab stop.