Keyboard, focus and widgets · senior
Widget patterns from the ARIA APG: combobox, tabs, menu button, listbox
For custom widgets, follow the WAI-ARIA Authoring Practices Guide pattern exactly: the right roles and states plus the expected keyboard model, using roving tabindex (move real focus) or aria-activedescendant (focus stays on the container or input) for arrow-key navigation.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
- Composite widgets have ONE Tab stop; arrow keys move inside. Roving tabindex: the active item has tabindex=0, others -1, and arrow keys call .focus() on the next item.
- aria-activedescendant: DOM focus stays on the input or container and aria-activedescendant points to the id of the 'active' option; used by comboboxes so typing continues in the input.
- Combobox: input role=combobox, aria-expanded, aria-controls -> listbox, aria-autocomplete; Down Arrow opens/moves into options, Enter selects, Escape closes; options role=option with aria-selected. Announce result counts with a live region.
- Tabs: tablist / tab / tabpanel; aria-selected on the active tab; aria-controls and aria-labelledby link tab and panel; Left/Right arrows (wrapping), Home/End; automatic activation only if panels show without delay.
- Menu button: button with aria-haspopup and aria-expanded; role=menu/menuitem is for app-like action menus, not for site navigation (use a list of links or the disclosure pattern for nav).
- Use tested libraries (React Aria, Radix UI, Headless UI, Ariakit) for complex widgets; test with real screen readers because support differs.
The red pen
Common traps: mistake → fix
Mistake: "Every item in a list should be tabbable"
Fix: a composite widget should be one Tab stop with arrow-key navigation inside.
Mistake: "Use role=menu for the site navigation"
Fix: menu roles change screen-reader behaviour and expect app-menu keys; use links in a nav.
Mistake: "The ARIA roles are enough for a combobox"
Fix: without the keyboard model and live announcements it's still unusable.
Easy to hard
Questions interviewers ask, easy to hard
- You built a custom searchable dropdown in the machine-coding round. Now make it accessible.
- Roving tabindex vs aria-activedescendant: how do they differ, when do you use each?
- Walk me through the keyboard behaviour of an accessible tabs component.
- How would you build an accessible OTP input?
Practise
Practise with these questions
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.