跪拜 Guibai
← All articles
Frontend · JavaScript · Programmer

7 React UI libraries' dropdowns tested with real keystrokes: Radix eats Tab, Arco drops focus, Ant Design hides options from screen readers

By kyriewen ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Keyboard-driven users and screen reader users in admin systems will hit these exact focus traps, and a single swallowed Tab or lost focus can silently break a data-entry workflow hundreds of times a day. Teams using Radix or shadcn should expect to patch Tab exit behavior themselves, and teams with accessibility requirements cannot trust a library's visible option count.

Summary

One developer with a no-mouse workflow loaded the latest versions of Ant Design, MUI, Radix, Mantine, Headless UI, Semi Design, and Arco into isolated pages and drove real keyboard events via Playwright. The test path: focus, open, select, close, leave. Seven predefined WAI-ARIA checks were run, with a div holding the onChange value as ground truth.

Six libraries passed all seven checks, but the failures expose gaps between "can select" and "can move through." Radix never lets Tab escape an open list; Arco only opens with Enter and sends focus to body after Esc; Ant Design's accessibility tree shows far fewer options than the visible DOM. Semi adds a stray "tick" label to every option. The manual 2-minute self-check script is included, along with wrapper-layer patches for Arco and Radix.

The takeaway: component library keyboard support is passable by default, but the only reliable fixes come from testing the open-state Tab behavior and post-close focus restoration, which the docs rarely describe.

Takeaways
— 7 libraries were tested: Ant Design 6.7.2, MUI 9.6.0, Radix UI 2.4.1, Mantine 9.8.2, Headless UI 2.2.10, Semi Design 2.105.1, Arco Design 2.66.18
— 6 of 7 passed all 7 keyboard checks; Radix and Arco each failed exactly 1 check
— Radix fails open-state Tab: focus stays on the first option and the panel never closes, so only Esc can exit
— Arco does not open on ArrowDown or Space; only Enter opens the panel
— Arco's Esc and Enter both leave document.activeElement on body, so the next Tab restarts focus from the first page element
— Ant Design's visible 5 options have no role="option"; only 2-3 option nodes exist in the accessibility tree, and earlier ones disappear as the highlight moves
— Semi Design reads each option as "tick Beijing" because the checkmark icon carries aria-label="tick" instead of aria-hidden
— MUI returns focus to the trigger on the first Tab after the panel opens, then leaves on a second Tab — a style difference, not a WAI-ARIA violation
— A minimal Playwright script can check both focus-loss failures by reading document.activeElement after Esc and after an open-state Tab
Conclusions

The gap between "selectable" and "navigable" is real: all 7 libraries let you pick an option, but only Radix and Arco trap or drop the keyboard entirely; the other failures are screen-reader-specific and invisible to mouse users.

Radix's Tab swallowing is the most dangerous failure because it's invisible during normal GUI testing and only surfaces when a keyboard user presses Tab after opening a dropdown.

Ant Design's approach to options suggests the visible list is used purely for pointer events, with a separate virtualized accessibility tree — a design that may optimize rendering at the cost of screen reader accuracy.

Arco's lost focus after Esc is a classic "focus restoration" bug that no test suite would catch unless it checks document.activeElement, which is why the article's inclusion in CI is valuable.

MUI's two-step Tab (close then leave) is a good example of where WAI-ARIA compliance and user feel diverge: standards pass, but heavy keyboard users notice the extra key press.

The author's method of pre-defining 7 checks and using real Playwright keystrokes rather than synthetic KeyboardEvent dispatches is a reminder that synthetic events cannot validate browser focus management.

Concepts & terms
WAI-ARIA
WAI-ARIA (Web Accessibility Initiative - Accessible Rich Internet Applications) defines roles, states, and keyboard behavior for complex UI components like comboboxes, including the expectation that ArrowDown opens the list, Enter selects, Esc closes and returns focus, and Tab must not trap the user.
Focus restoration
The expected behavior that after a popup or panel closes, keyboard focus returns to the element that opened it (the trigger). Losing it to body means the next Tab starts from the beginning of the page, breaking the user's navigation context.
Accessibility tree
The browser's internal representation of the DOM as seen by assistive technologies; it can contain fewer or different nodes than the visual layout, and options not present in this tree are invisible to screen readers.
aria-setsize
An ARIA attribute that tells assistive technologies how many items are in a list or set; in Ant Design's case it always reports 5 while the accessibility tree only exposes 2-3 options at a time.
From the discussion
Featured comments
组合搭配函数

This testing method is sound. The part about losing focus is the real issue. Being able to select something and being truly usable are worlds apart.

kyriewen

Nice.

See top comments, translated →
Source: juejin.cn ↗ Google Translate ↗ Backup ↗