Keyboard and focus
Every component works from the keyboard. Tab moves between components, the arrow keys move inside the ones that have several items, and focus lands somewhere sensible after every change: a dialog closing, a row deleted, a form failing.
The focus ring
A 2px ring in the focus color (--ib-color-focus, your brand color by default) shows on the control that
has keyboard focus. A mouse click doesn't show it. Fields show focus with their border and a soft halo instead. In
Windows high-contrast mode, where borders and shadows lose their colors, fields also show an outline.
When Blazor's FocusOnNavigate moves focus to a page's heading, or the skip link moves it to the main area,
no ring shows there. Screen readers still announce the move.
Where focus goes
- AppShell starts with a "Skip to content" link to the main area, and it works after enhanced navigation too.
- Dialogs and drawers keep focus inside while open and return it to the control that opened them. A popover or menu takes focus when the user opens it and gives it back when it closes.
- After a failed submit, a
FormErrorsat the top of the form takes focus, even with JavaScript off, so the user starts from the list of problems. Without aFormErrors, the browser's own validation focuses the field. On static pages, a checkbox, radio or segmented group with an error takes focus. A dialog that reopens with errors focuses its first invalid field. - When the focused control goes away, such as a removed tag or a deleted row, focus moves to the nearest control instead of falling back to the top of the page.
- When the user closes a toast that has focus, focus moves to the next open toast, or back to where it was.
Focus not hidden behind sticky bars
When focus moves to a control under AppShell's sticky header or footer, the page scrolls it into view with some room to
spare. A sticky table header does the same for the rows under it. If you add a sticky bar of your own, give the scrolling
element a scroll-padding as tall as the bar.
Keys
- A component that has several items, such as tabs, a toolbar, a tree, a grid or a chart, is one Tab stop. The arrow keys move inside it, and Home and End go to its ends.
- Arrow keys follow the page's direction: on a right-to-left page, Left moves forward.
- Shortcuts that aren't part of a standard pattern, such as Alt+Down on a split button or Alt+Arrow keys on a list's, grid row's or tile's drag handle, are announced with
aria-keyshortcuts. - Single-letter shortcuts, such as the Scheduler's T for today, work only while focus is inside the component. To turn them off, set
Shortcuts="false"on the Scheduler. - Keys that IzzyBlazor's script adds don't work with JavaScript off. The native ones, such as Space on a checkbox or the arrows in a radio group, still work.
Every component's keys
Each of these components lists its keys in a Keyboard navigation table under its Overview's Accessibility section. The others use only the browser's own keys: Tab, Enter, Space, Escape and the arrows in a native control.