跪拜 Guibai
← Back to the summary

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

I have a habit of avoiding the mouse whenever possible; my backend forms are operated almost entirely by keyboard. So when I see the phrase "component libraries support keyboard operation," I've always wanted to verify whether that "support" means you can make a selection, or you can fully move in and out.

This time I loaded 7 mainstream React component libraries onto the same test page, used Playwright to send real key presses, and ran the same path: focus → open → select an item → close → leave. Bottom line first: the basic keyboard operations all work; the problems aren't in "can you select," but in where the focus goes after selecting and closing, and how many options a screen reader can hear.

How I tested

All 7 libraries were the latest versions installed from npm that same day: Ant Design 6.7.2, MUI 9.6.0, Radix UI 2.4.1 (the base for shadcn), Mantine 9.8.2, Headless UI 2.2.10, Semi Design 2.105.1, Arco Design 2.66.18.

Each library was loaded in its own page to keep global CSS from contaminating each other. A button was placed before and after the component to check whether focus could enter and exit. The options were fixed at 5: Beijing, Shanghai, Guangzhou, Shenzhen, Hangzhou. onChange wrote the value into a div on the page, which served as the single source of truth for "was it actually selected" — not the visual text changes.

The evaluation criteria were defined in advance, with 7 checks:

# Check Pass condition
C1 Tab to focus After the button before the component, 1 Tab moves focus into the trigger
C2 Open with keyboard Pressing ↓ or Enter opens the panel
C3 Move highlight Pressing ↓ again changes exactly one option's highlight state
C4 Enter selects After Enter, onChange outputs a non-empty value
C5 Esc closes and returns focus Panel disappears, focus returns to the trigger
C6 Tab away while closed Pressing Tab moves focus out of the component, not to body
C7 Tab not trapped while open When open, pressing Tab closes the panel or moves focus out of the options

These 7 checks are not my invention. The WAI-ARIA keyboard conventions for dropdowns are clear: ↓ opens and enters the list, ↑/↓ move, Enter selects, Esc closes and returns focus to the trigger, and Tab must be able to take focus away. I split them into minimal steps that press one key at a time, so any failure can be pinpointed to a specific key press — no vague "overall it doesn't feel right" conclusions that can't be reproduced.

Before running, I actually hit some pitfalls. In the first round, I captured antd's highlight snapshot on a 0×0 hidden list and concluded it didn't move on ↓; but when I pressed Enter next, the selected value was "Guangzhou" — one step further, which meant the highlight had moved. Tracing that line revealed that antd's role="option" isn't on the visible options at all. Also, Arco didn't open on ↓, so the later steps in the first round all used the wrong key. After fixing both, the results reproduced twice, and I kept both rounds of raw data.

A quick note on why I used Playwright to send real key presses rather than dispatching KeyboardEvent myself: synthetic events bypass the browser's default behavior and focus management, so testing "keyboard support" that way would be fake support. With real key presses, where focus goes and whether the panel opens are all decided by the browser itself.

Results: 6 libraries 7/7, but passing everything isn't the same as having no issues

Library ↓ opens Tab focus ↓ moves highlight Enter selects Esc returns focus Tab closed state Tab open state Screen reader visible options
Ant Design ✓ ✓ ✓ ✓ ✓ ✓ ✓ 2 / 5
MUI ✓ ✓ ✓ ✓ ✓ ✓ ✓ 5 / 5
Radix UI ✓ ✓ ✓ ✓ ✓ ✓ ✗ 5 / 5
Mantine ✓ ✓ ✓ ✓ ✓ ✓ ✓ 5 / 5
Headless UI ✓ ✓ ✓ ✓ ✓ ✓ ✓ 5 / 5
Semi Design ✓ ✓ ✓ ✓ ✓ ✓ ✓ 5 / 5
Arco Design ✗ needs Enter ✓ ✓ ✓ ✗ lands on body ✓ ✓ 5 / 5

6 libraries scored 7/7; Radix and Arco each 6/7. If you only look at this table, you'd think "modern component libraries have passed the keyboard support test." Passing is true, but there are only three places worth opening your own project and checking.

Radix: once the panel opens, Tab stops working

This was the most surprising of the three. After opening the panel and pressing Tab 6 times, focus stayed on "Beijing" and the panel didn't close; trying Shift+Tab went the same way. The only way out was Esc.

Its other keyboard paths are all correct: ↓ opens, ↓ moves, Enter selects, Esc closes and returns focus — hence 6/7. The failing check is C7: when open, Tab doesn't "close and leave," it gets swallowed.

The reason isn't complicated: Radix uses "real focus" mode, moving the DOM focus into the options list when opened. After moving it in, there's no Tab exit logic, so focus circles inside the content area. Mouse users won't notice it at all; for keyboard users, it means: I thought Tab would move to the next input, but my keystrokes all went into the list.

As a side note, MUI also moves focus into the options, but Tab first closes the panel and returns focus to the trigger, then a second Tab leaves. Same path, with a "return" difference in handling.

MUI's extra Tab — does it count as a problem?

Strictly, no. It satisfies "Tab can leave without Esc," but the first Tab splits that action in two: close first, then go. I marked it as pass in the table because per WAI-ARIA, Tab only needs to not trap people; once or twice is a stylistic difference.

But that difference is noticeable in continuous operations: warehouse entry, financial reconciliation scenarios easily go through hundreds of dropdowns a day, and each extra Tab is hundreds of extra key presses. So my suggestion is — judge by the standard, feel by the scenario. Don't dismiss a library just because it failed my table, and don't ignore the extra keystrokes the user feels just because it passed the standard.

The only thing that truly deserves a death sentence is when Tab does nothing at all, like Radix.

Arco: after Esc, the cursor disappears

Arco's problem is "after closing."

Press Esc, the panel does close, but document.activeElement becomes body — focus doesn't return to the trigger; it falls to the page root. Same after selecting an item with Enter. The consequence is concrete: the next Tab restarts focus from the first focusable element on the page, not from where you were operating.

It has a second flaw: ↓ doesn't open the panel, and Space doesn't either; only Enter opens it. Arrow-key opening is the most basic dropdown convention, and that failure means all muscle memory relying on "↓ enters the list directly" is gone.

The two problems stack up, making Arco the worst of the 7 for keyboard continuity — not unusable, but you always have to "find your way again."

Ant Design: 5 options on screen, screen reader hears only 2

Ant Design passes all 7 checks; there's nothing wrong with its keyboard flow. But after exporting the browser's accessibility tree, the situation looks like this:

- combobox "City" [expanded]:
  - listbox:
    - option "Beijing"
    - option "Shanghai"

Visually there are 5 options, but the accessibility tree only has 2. Press ↓ again, the auxiliary list becomes 3 — Guangzhou comes in, Beijing gets squeezed out; continue pressing, and the window keeps sliding. Yet the aria-setsize on those auxiliary options always says 5.

Look at the visible 5 options: they're div.ant-select-item-option, and none of them carry role="option". The ones with the role are in another hidden container with width: 0; height: 0.

This means: mouse and regular keyboard users see 5 items and can select 5; screen reader users going down the listbox will only hear 2 to 3 items, and earlier options vanish as the highlight moves. I'm not making a judgment here about why it's designed that way — I'll just deliver this observation. Version 6.7.2, tested in Chrome.

Semi: option labels read as "tick Beijing"

This one is minor, but typical. Semi's option checkmark icon carries an aria-label="tick", so the screen reader reads "tick Beijing," "tick Shanghai." Everything functions, just a useless word prefixed to every option name.

Decorative icons should hide their name:

<IconTick aria-hidden="true" focusable="false" />

One line. But this kind of problem won't appear in any test case; you only hit it by actually walking through with a screen reader.

What to look at when choosing a library

I'm not offering a "ranking." All 7 have adequate keyboard basics; what you should decide per project is three things:

If you don't have time to switch libraries, both of these can be patched at the wrapper layer: Arco uses onVisibleChange, Radix uses onOpenChange, catching the "panel closed" moment and manually returning focus to the trigger; Radix's Tab issue can be handled by adding a Tab listener on the content area that closes the panel when intercepted. Neither is a root fix, but they cover the path that most hurts continuous operation.

For self-checking (copyable)

First a manual version that takes 2 minutes in any production environment, no code needed:

  1. Click blank space on the page, press Tab — does focus land on the component once?
  2. Press ↓, does the panel open? If not, try Enter and note which key works.
  3. Press ↓ again, does the highlight move down one step?
  4. Enter, does the value change?
  5. After Esc, does the focus ring return to the trigger? Or can you not find focus anywhere on the page?
  6. Reopen and press Tab once — neither the panel closes nor focus leaves, then you're trapped.
  7. Open DevTools Elements, search for role="option", and if the count doesn't match the visual option count, investigate.

Checks 5 and 6 are the only places that failed in this round, and the parts docs never tell you.

For automation, a minimal script covers the two most critical checks:

const s = page.locator('[role="combobox"]').first();
await s.focus();
await page.keyboard.press('ArrowDown');
await page.keyboard.press('Escape');
console.log(await page.evaluate(() => document.activeElement?.tagName));

activeElement being BODY is the Arco-style "focus lost after closing." Replace the last line with an open-state Tab to test check 6:

await s.focus();
await page.keyboard.press('ArrowDown');
await page.keyboard.press('Tab');
console.log(await page.evaluate(() => document.activeElement?.getAttribute('role')));

Output option with the panel still open is the Radix-style trap. This can be dropped into any E2E suite and run on CI, more reliable than manually clicking dozens of pages.

Finally

The biggest takeaway from this round isn't "who's bad," but: "Supports keyboard operation" in component library docs usually means you can select something; what keyboard users really care about is where I still stand after closing. These two things differ by 5 check items.

Which of the 7 are you using? Have you had complaints from users or QA about focus issues? Chat in the comments, and I'll run another round of tests on the libraries you mention.

Comments

Top 1 of 2 from juejin.cn, machine-translated. The original thread is authoritative.

组合搭配函数

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.