Repository navigation
fix(menus): the keys and type-ahead reach a disabled row, which stays inert - #10160
Conversation
… inert In DropdownMenu, its sub-menus, MoreMenu, ContextMenu and NavHeadingMenu the arrow keys, Home, End, the Page keys and type-ahead visit a disabled row as any other row. The row takes focus (tabindex -1), is announced as disabled, and Enter, Space or a click on it does nothing and leaves the menu open. A keyboard open still lands on an enabled row. useListFocus gains the internal reachesDisabledItems option for this; presses keep the enabled-row selector (component:DropdownMenu FR17, DEC-11). Fixes #8838
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec e535e1a |
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| lab/Comments | 328.9 kB (+180 B) · 2.5 kB CSS (0) | — | — · — · — |
| lab/CommentThread | 322.3 kB (+176 B) · 2.4 kB CSS (0) | — | — · — · — |
| DropdownMenu | 95.4 kB (+130 B) · 17.1 kB CSS (0) | — | ✓ · ✓ · ✓ |
36 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| DropdownMenuSubMenu | 68.8 kB (+124 B) · 9.7 kB CSS (0) | — | ✓ · ✓ · ✓ |
| BreadcrumbItem | 83.1 kB (+115 B) · 12.0 kB CSS (0) | — | — · — · — |
| MoreMenu | 95.7 kB (+111 B) · 17.1 kB CSS (0) | — | — · — · — |
| Table | 116.1 kB (+100 B) · 17.7 kB CSS (0) | — | — · — · — |
| TableHeaderCell | 106.8 kB (+93 B) · 17.2 kB CSS (0) | — | — · — · — |
| DropdownMenuRadioItem | 22.6 kB (+88 B) · 6.6 kB CSS (0) | — | ✓ · ✓ · — |
| TableCell | 107.2 kB (+87 B) · 17.4 kB CSS (0) | — | — · — · — |
| ContextMenu · Storybook | 106.0 kB (+86 B) · 17.0 kB CSS (0) | 704 (+2) | ✓ · ✓ · ✓ |
| DropdownMenuCheckboxItem | 22.6 kB (+84 B) · 6.6 kB CSS (0) | — | ✓ · ✓ · ✓ |
| Markdown | 179.2 kB (+84 B) · 20.0 kB CSS (0) | — | — · — · — |
| SegmentedControl | 92.0 kB (+65 B) · 6.8 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditorToolbar | 249.9 kB (+62 B) · 454 B CSS (0) | — | — · — · — |
| TabMenu | 70.3 kB (+60 B) · 11.0 kB CSS (0) | — | — · — · — |
| PowerSearch | 280.9 kB (+54 B) · 23.5 kB CSS (0) | — | — · — · — |
| Pagination | 107.9 kB (+53 B) · 17.5 kB CSS (0) | — | — · — · — |
| AvatarGroup | 44.2 kB (+51 B) · 5.6 kB CSS (0) | — | — · — · — |
| lab/CommentPin | 55.3 kB (+46 B) · 1.2 kB CSS (0) | — | — · — · — |
| TopNavHeading | 73.5 kB (+45 B) · 11.0 kB CSS (0) | — | — · — · — |
| TableSelectionToolbar | 68.6 kB (+44 B) · 13.0 kB CSS (0) | — | — · — · — |
| TopNavMenu | 73.1 kB (+44 B) · 11.1 kB CSS (0) | — | — · — · — |
| DateTimeInput | 203.6 kB (+43 B) · 18.4 kB CSS (0) | — | — · — · — |
| ButtonGroup | 41.2 kB (+42 B) · 3.7 kB CSS (0) | — | — · — · — |
| TabList | 42.1 kB (+42 B) · 6.5 kB CSS (0) | — | — · — · — |
| lab/Schedule | 104.0 kB (+39 B) · 3.9 kB CSS (0) | — | — · — · — |
| NavHeadingMenu | 16.0 kB (+38 B) · 3.5 kB CSS (0) | — | ✓ · ✓ · ✓ |
| Toolbar | 41.3 kB (+37 B) · 8.0 kB CSS (0) | — | — · — · — |
| ContextMenuItem | 28.7 kB (+36 B) · 6.3 kB CSS (0) | — | — · — · — |
| TopNavMegaMenu | 68.3 kB (+36 B) · 11.7 kB CSS (0) | — | — · — · — |
| SideNavHeading | 74.1 kB (+34 B) · 11.2 kB CSS (0) | — | — · — · — |
| DropdownMenuItem | 21.8 kB (+27 B) · 6.3 kB CSS (0) | — | ✓ · ✓ · — |
| lab/TabBar | 73.9 kB (+26 B) · 1.8 kB CSS (0) | — | — · — · — |
| SideNavItem | 69.0 kB (+22 B) · 11.0 kB CSS (0) | — | — · — · — |
| DropdownMenuDivider | 5.2 kB (0) · 548 B CSS (0) | — | ✓ · ✓ · — |
| DropdownMenuGroup | 6.3 kB (0) · 3.4 kB CSS (0) | — | ✓ · ✓ · — |
| DropdownMenuRadioGroup | 6.5 kB (0) · 3.3 kB CSS (0) | — | ✓ · ✓ · — |
| lab/TabBarItem | 3.8 kB (0) · 1.8 kB CSS (0) | — | — · — · — |
Package size: @astryxdesign/core 6.94 MB packed (+1.5 kB); no new dependencies.
API changes: none in this pull request
Committed API report behind this build: cli 21 rows, core 39 rows; run pnpm api:report.
Touched components checked; add ci:run-visual or ci:run-rtl to run the full suites.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Requesting changes. Disabled item, checkbox and radio rows are now reachable from the keyboard and stay inert, as component:DropdownMenu FR17 asks. Two things need fixing first:
- A disabled
DropdownMenuSubMenurow still renders notabindex(DropdownMenuSubMenu.tsx:1222), so the arrow keys now target a row that cannot take focus and ArrowDown stops on the row above it in DropdownMenu, MoreMenu and ContextMenu; give ittabIndex={-1}and add a test that ArrowDown reaches it while ArrowRight, Enter and Space open nothing. DropdownMenuAudit.a11y.chromium.spec.ts(lines 546-552, thedisabled-rowcases) still expects End to skip the trailing disabled row, so it fails once CI runs; update it to expect the disabled row and to assert that the row is exposed as disabled.
Also correct the description's "a pointer still never acts on or highlights a disabled row": a click now focuses the row and paints its focus fill. CI has not run on this draft head yet.
[Automated review]
…cs say the keys reach it A disabled DropdownMenuSubMenu row carries tabindex -1 like the other rows, so ArrowDown reaches it and moves past it. The DropdownMenu audit's disabled-row state, the checkbox and radio row docs, and a new real-browser keyboard spec state that the keys reach a disabled row.
There was a problem hiding this comment.
Requesting changes: the arrow keys, Home, End and type-ahead now reach disabled rows in all five menus as component:DropdownMenu FR17 asks, and the new tests fail on main and pass here. Two things need fixing first:
- Miss: a mouse press on a disabled row now moves focus onto it and paints its focus fill, because the new
tabIndex={-1}(for exampleDropdownMenuItem.tsx:280) makes the row focusable onmousedown, whilemodule:DropdownMenu/useMenuPressFR2 keeps a disabled row unlit under a press; keep a press from focusing a disabled row (for examplepreventDefault()on itsmousedownin the shared press path) and add a test for it. - Miss:
docs/specs/components/DropdownMenu/DropdownMenu.spec.mdline 48 still says disabled-row keyboard reach (FR12, FR17) is listed under Current-state impact, but this pull request removes that entry, so drop it from that row.
Fixing the first also makes the docs' "The pointer highlight skips it" and the changeset's "a click on it still does nothing" true. CI has not run on this draft head yet.
[Automated review]
|
/approve-spec 885a2c9 |
A disabled row now takes focus from the keys, so the menu press keeps a mouse press on it from focusing and lighting it (useMenuPress FR2). The DropdownMenu record's contract row no longer lists the closed gap.
…ed, in a real browser
There was a problem hiding this comment.
Approval waits on an engineering owner's decision, and two fixes are needed first.
The arrow keys, Home, End and type-ahead now reach disabled rows in all five menus as component:DropdownMenu FR17 asks, the new tests fail on main and pass here, and a mouse press on a disabled row still leaves it unfocused.
- Owner decision:
useMenuPressis a public hook, and this addsonMouseDownto itsUseMenuPressReturn['menuProps'], which no current record covers, so an engineering owner (the author may answer as one) decides whether the public hook carries it or the guard stays inside core's menus, and records it by commenting/approve-spec <full head SHA>once the record names the member. - A caller's
onMouseDownonDropdownMenuandNavHeadingMenuno longer runs, because the spreadmenuPress.menuPropsnow brings its ownonMouseDown(DropdownMenu.tsx:1715,NavHeadingMenu.tsx:229); compose the caller's handler with the guard and add a test. useMenuPressloses its JSDoc, becausekeepFocusOffDisabledRownow sits between the hook's comment and its declaration (useMenuPress.ts:319); move the helper above that comment.
CI has not run on this draft head yet.
[Automated review]
…nuPress is unchanged The useMenuPress menuProps.onMouseDown goes: it was a new field on the public return and dropped a caller's onMouseDown. Each Core row (DropdownMenuItem, CheckboxItem, RadioItem, SubMenu row, NavHeadingMenuItem) instead composes its own onMouseDown, after the caller's, that cancels the press's focus while the row is disabled.
There was a problem hiding this comment.
Approved pending CI: CI has not run on this draft head yet.
The arrow keys, Home, End and type-ahead now reach disabled rows in all five menus as component:DropdownMenu FR17 asks, the new tests fail on the base and pass here, and each disabled row now keeps a mouse press's focus off itself without changing useMenuPress, so a caller's onMouseDown reaches the menu again.
- Resolve the conflict with
maininDropdownMenu.spec.mdby keeping main's "the still mouse (FR22)" in the Contract at a glance row and dropping "disabled-row keyboard reach (FR12, FR17)". - Non-blocking: the
menuItemRoles.tsheader does not name the newkeepDisabledRowUnfocused, and the comment atDropdownMenu.test.tsx:2571says Home and End reach a disabled row while that case's first and last rows are enabled.
[Automated review]
| /** | ||
| * @file menuItemRoles.ts | ||
| * @output Shared menu-item role set + focus selector + keyboard activation. | ||
| * @output Shared menu-item role set, row selectors, and keyboard activation. |
There was a problem hiding this comment.
Non-blocking: this header, and @position below ("used by DropdownMenu and ContextMenu"), does not name the new keepDisabledRowUnfocused, which the four DropdownMenu rows and NavHeadingMenuItem now import. Suggest: @output Shared menu-item role set, row selectors, keyboard activation, and the disabled-row press guard.
|
/approve-spec f68693b |
…till-mouse note kept; disabled-row reach gap closed)
|
/approve-spec 05232a6 |
There was a problem hiding this comment.
Requesting changes for one documentation fix; nothing else blocks.
The arrow keys, Home, End and type-ahead now reach disabled rows in all five menus as component:DropdownMenu FR17 asks, the new tests fail on the base and pass here, and a mouse press on a disabled row still leaves it unfocused.
- Miss: the
isDisabledJSDoc ofDropdownMenuCheckboxItem(DropdownMenuCheckboxItem.tsx:121-123) andDropdownMenuRadioItem(DropdownMenuRadioItem.tsx:114-117) still says a disabled row "takes no focus" and that the arrow keys and typeahead skip it, so reword both to match the corrected.doc.mjstext. - Non-blocking: the
menuItemRoles.tsheader and the comment atDropdownMenu.test.tsx:2572are still as noted earlier.
CI has not run on this head because the pull request is still a draft.
[Automated review]
…s the keys reach a disabled row The JSDoc still said a disabled row takes no focus and the keys skip it, the opposite of what the rows now do and of their docs.
|
/approve-spec ebd5387 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet because the pull request is still a draft, so it runs once the pull request is marked ready for review.
The arrow keys, Home, End and type-ahead now reach disabled rows in all five menus as component:DropdownMenu FR17 asks, the new tests fail on the base and pass here, a mouse press on a disabled row still leaves it unfocused, and the checkbox and radio rows' isDisabled JSDoc now matches that behavior.
- Non-blocking: the
menuItemRoles.tsheader does not namekeepDisabledRowUnfocusedor itsNavHeadingMenuItemcaller, and the comment atDropdownMenu.test.tsx:2572says End and Home reach a disabled row while both land on enabled rows.
[Automated review]
DropdownMenuSubMenu.spec.md: main's table (with FR11), minus the FR7
gap ('a disabled row renders no tabindex today') this branch closes.
|
/approve-spec 6d2d2d6 |
There was a problem hiding this comment.
Requesting changes for one keyboard-open case; everything else checks out.
- Miss: in a drilled-in sub-menu (a phone or tablet, or
presentation="drill-in") whose first row is disabled, a keyboard open now focuses that disabled row, becauseDropdownMenuSubMenu.tsx:797takesitems[1]from the row list this change widens to disabled rows, againstcomponent:DropdownMenuFR17 andcomponent:DropdownMenuSubMenuFR2; pick the first enabled row after Back and add a drill-in test beside the flyout case.
The arrow keys, Home, End and type-ahead reach a disabled row in all five menus, the row stays inert, and the new and flipped tests fail on main and pass here. Two earlier non-blocking notes, the menuItemRoles.ts header and the Home/End comment in DropdownMenu.test.tsx, are still open. CI has not run on this draft head yet.
[Automated review]
…led row after Back The drilled view's row list now includes disabled rows, so a drill-in whose first child was disabled opened on it. The open now lands on the first enabled row after Back; ArrowUp still reaches the disabled one.
|
/approve-spec b472e59 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this draft head yet.
A keyboard drill-in now lands on the first enabled row after Back, with a phone test that fails without the fix, so the last blocking issue is resolved. The arrow keys, Home, End and type-ahead reach a disabled row in all five menus, the row is announced as disabled and stays inert, and a keyboard open still lands on a row that acts. One earlier non-blocking note is still open: the menuItemRoles.ts header does not mention the new press guard or NavHeadingMenuItem.
[Automated review]
|
/approve-spec 443a0ab |
There was a problem hiding this comment.
Approved pending CI: the required build, test and docsite-test suites were deferred on this push and have not run on this head yet; they run on the pre-merge re-run.
The arrow keys, Home, End, the Page keys and type-ahead now reach a disabled row in DropdownMenu, its sub-menus, MoreMenu, ContextMenu and NavHeadingMenu. The row is announced as disabled and stays inert, a keyboard open still lands on an enabled row, and a mouse press still leaves the row unfocused. The new and flipped tests fail on main and pass here.
Two optional follow-ups, neither blocking:
- Miss:
DropdownMenuCheckboxItemandDropdownMenuRadioItemalso ship asBreadcrumbMenuCheckboxItemandBreadcrumbMenuRadioItem, and a breadcrumb's menu still skips disabled rows, so the newisDisableddocs could scope the reach sentence to the menus that give it. - The
menuItemRoles.tsheader could name the new disabled-row press guard and the rows that import it.
[Automated review]
Fixes #8838.
User impact
A keyboard or screen-reader user in
DropdownMenu, its sub-menus,MoreMenu,ContextMenuorNavHeadingMenunever reaches a disabled row today: ArrowDown, ArrowUp, Home, End and type-ahead skip it. The user does not learn the row exists or why it is unavailable (for example a description such as "Only the owner can delete"). After this fix those keys visit a disabled row like any other row. The row takes focus and is announced as disabled, and Enter, Space or a click on it still does nothing and leaves the menu open. Opening a menu from the keyboard still lands on an enabled row.Problem and solution fit
MENU_ITEM_SELECTOR, which excludes[aria-disabled="true"].useListFocusalso skips disabled items itself, and a disabled row renders notabindex, so it cannot take focus.component:DropdownMenuFR17 and DEC-11 require the keys to reach a disabled row and the row to stay inert, in all five menus.Expected behavior and authority
component:DropdownMenuFR17, FR12 and DEC-11: the arrow keys, Home, End, the Page keys and type-ahead visit a disabled row; it takes focus, exposesaria-disabled="true"and stays inert; a keyboard open lands on an enabled row.component:DropdownMenuItemFR7,component:DropdownMenuCheckboxItemFR3,component:DropdownMenuRadioItemFR4,component:DropdownMenuSubMenuFR7,component:ContextMenuFR8, andcomponent:NavHeadingMenuFR5 and FR6 restate it for each row and menu.Smallest restoration
useListFocusgains one internal option,reachesDisabledItems. With it, the navigation keys pass over no item;focusFirstandfocusLast, which an open uses, still land on an enabled item. The public hook and every other list are unchanged, so Toolbar and ButtonGroup keep their own rule.onMouseDown, after the caller's, that cancels a mouse press's focus while the row is disabled. The row now takes focus from the keys, and without this a press would focus and light it (module:DropdownMenu/useMenuPressFR2).useMenuPressand its public return are unchanged.menuItemRoles.tsaddsMENU_ROW_SELECTOR(every row). The five menus use it for keyboard focus and type-ahead. Presses keep the enabled-onlyMENU_ITEM_SELECTOR, so a pointer still never acts on or highlights a disabled row.DropdownMenuItem,DropdownMenuCheckboxItem,DropdownMenuRadioItem,DropdownMenuSubMenuandNavHeadingMenuItemrow now carriestabindex="-1", as an enabled row does.tabindex="-1".Evidence
main's source with the flipped tests): 8 of 8 new and flipped cases fail. The keys and type-ahead skip the disabled row, and a disabled row has notabindex.useListFocus.DropdownMenuDisabledRow.a11y.browser.spec.tson the WithDisabledItems story: a keyboard open lands on Edit; ArrowDown and End reach "Delete (disabled)", exposed to the accessibility tree as a disabled menu item; Enter and Space on it do nothing and leave the menu open; a mouse press on it leaves it unfocused. The DropdownMenu audit's disabled-row state now asserts End lands on the trailing disabled row.main's current copy (13 of 13), the copy CI runs. The visual audit specs need a git checkout; CI runs them.tabindex="-1", does nothing on Enter or Space and leaves the menu open; Home and End; a sub-menu's keyboard open past a disabled first row; and NavHeadingMenu's keys and type-ahead.Scope
Testing
vitest run packages/core/src/DropdownMenu packages/core/src/ContextMenu packages/core/src/NavMenu packages/core/src/MoreMenu packages/core/src/SideNav packages/core/src/TabList packages/core/src/Breadcrumbs packages/core/src/Toolbar packages/core/src/ButtonGroup packages/core/src/hooks/useListFocus.test.tsx packages/core/src/TopNavmain's source (red), then this head (green).Writing rubric results
R1 narration: none added; the edits remove "today" gap sentences, and every remaining sentence is present tense.
R2 research: none in the records.
R3 evidence: unchanged; FR17's verification row already names the keyboard tests these cases fill.
R4 rejected alternatives: none added.
R5 change references: none.
R6 open questions: none added; NavHeadingMenu's gap count drops from six to four.
ebd5387 (JSDoc-only follow-up: the checkbox and radio rows'
isDisabledJSDoc now matches their docs and behavior): this head's checks are CI-only.