Repository navigation
fix(site): convey selected and current state to screen readers - #32020
Conversation
…cted cmdk sets aria-selected on whichever row is highlighted, so screen readers announced the highlighted row as selected and never the row with the check mark. Patch cmdk so an Item's aria-selected prop wins (it now finds the highlighted row by data-selected), and pass the chosen state from every cmdk-based picker. FilterCombobox lists are marked multiselectable and its rows report whether their value is applied.
…screen readers Mark the workspace breadcrumb with aria-current="page", the Resources and History sidebar toggles with aria-pressed, and the selected resource in the Resources sidebar with aria-current, so the state is not conveyed visually only (WCAG 4.1.2).
Mark the Create Organization row as not selected, assert chosen state through role queries, cover the FilterCombobox flyout and suggestion rows and CompactProjectSelector's chosen row, move the FilterCombobox story to data-selected for the highlight, and drop a comment that described the caller instead of the component.
…issing-incorrect # Conflicts: # site/src/components/Command/Command.test.tsx
Replaces `site/patches/[email protected]` with [`@coder/[email protected]`](https://www.npmjs.com/package/@coder/frimousse), Coder's fork of Frimousse at [coder/frimousse](https://github.com/coder/frimousse). 0.4.1 includes the same fix the patch made: one-based `aria-rowindex` and `aria-colindex` (upstream liveblocks/frimousse#39, applied in coder/frimousse#4). It is published from the fork's release workflow with npm trusted publishing. - `frimousse` becomes `@coder/frimousse` in `package.json` and in the two imports. - The patch and the `patchedDependencies` entry are removed. - `minimumReleaseAgeExclude` allows this exact version. pnpm holds back versions published in the last day, and 0.4.1 was published on 2026-11-16, so `pnpm add` wrote this entry. It can be removed later, or replaced on the next bump. - The lockfile records the registry tarball URL, as the nix build requires. No behavior change: the existing "numbers grid rows and cells from 1" test passes against the package, with no patch applied. Kept: the `site/patches/**` exclusion in `.github/workflows/typos.toml`. With this PR no patch remains, but the open #32020 adds a cmdk patch that needs it. This is step 3 of moving Frimousse changes to the fork. Next, coder/frimousse gets the DEQ-130 category header rows, and a follow-up coder/coder PR bumps to that release and replaces #32189. 🤖 Generated by Coder Agents on behalf of @aqandrew.
…issing-incorrect # Conflicts: # site/pnpm-lock.yaml # site/pnpm-workspace.yaml
chrifro
left a comment
There was a problem hiding this comment.
[reviewer-agent] round 1: changes needed at ae0d2a7.
The approach holds up: the cmdk patch makes only two semantic edits per bundle (the highlight lookup moves to data-selected, and the Item aria-selected prop wins via ??). Every surface in the 10 tickets maps to a changed component, and the 232 tests in the six changed test files pass locally. Two things block the merge:
- [blocking] The
Storybookcheck fails on this head.OrganizationAutocomplete.stories.tsx:85(SelectedOptionNotHighlighted, added on main in #32012 and merged in here) waits for the highlightedMockOrganization2row to havearia-selected="true". This PR now setsaria-selectedfrom the chosen org, so that wait times out. The play function threw in CI, the Pixel build failed, and the story fails locally on this head while passing on main 6267256. See the inline comment. - [blocking]
site/pnpm-workspace.yamlconflicts with main. #32301 removed theminimumReleaseAgeExcludeblock that sits next to the newpatchedDependenciesblock. See the inline comment.
Nits (optional):
FilterCombobox/primitives.tsx:330,357:aria-multiselectableon everyFilterComboboxList, combined with thearia-selected={false}default, means category, Retry, and loading rows are announced as "not selected". That is accurate and better than before, but it is noise on rows that can't be applied. Leaving the attribute off would need the patch to check"aria-selected" in propsrather than??.FilterCombobox/primitives.tsx:329: the comment mostly restatesaria-multiselectable. Likewise,FilterCombobox.test.tsx:188-189repeats thearia-selectedcontract thatFilterComboboxItem's JSDoc already documents.WorkspaceTopbar.tsx:368:aria-current="page"on a popover trigger is valid. It would read better inside a breadcrumb<nav>landmark.- New checks in
FilterCombobox.test.tsx:1054-1057andWorkspacePage.test.tsx:459-501are barefindByRole/getByRolecalls withpressed/current/selected. An explicitexpect(...).toHaveAccessibleName(...)would make clear which calls assert. Autocomplete.test.tsx:82: the newit.eachsits outsidedescribe(Autocomplete.name)..claude/docs/FRONTEND_PATTERNS.mdstill says cmdk overwritesaria-selected. That needs a follow-up PR outsidesite/.
Follow-ups filed (pre-existing, not blocking):
- DEQ-627: Inline-search Autocomplete never announces the highlighted option
- DEQ-628: MultiSelectCombobox announces the highlighted option as selected
🤖 Generated by Coder Agents on behalf of @chrifro.
…ght in SelectedOptionNotHighlighted The story arrows to another org and waited for aria-selected on it. That now reports the chosen org, so wait on cmdk's data-selected highlight instead.
…issing-incorrect # Conflicts: # site/pnpm-workspace.yaml
chrifro
left a comment
There was a problem hiding this comment.
[reviewer-agent] round 2: approved at d583eb0.
Both round-1 blockers are fixed: SelectedOptionNotHighlighted now waits on data-selected (92a48fb), and the pnpm-workspace.yaml merge keeps only patchedDependencies (d583eb0). Every required check passes, Storybook included. Since round 1, the PR's own diff has changed only in that story, the workspace file, and a renderComponent rename taken from main. The round-1 nits are still optional. Follow-ups: DEQ-627 and DEQ-628 (pre-existing).
🤖 Generated by Coder Agents on behalf of @chrifro.
Note
🤖 Generated by Coder Agents on behalf of @aqandrew.
Fixes the Deque
state-selected-missing-incorrectfindings (WCAG 4.1.2): screen readers either heard the wrong row as selected, or didn't hear the selected or current state at all.Listboxes. cmdk sets
aria-selectedon whichever row is highlighted and ignores the prop. So when focus landed on a picker, the first row was announced as "selected" and the row with the check mark wasn't. A small pnpm patch to cmdk 1.1.1 (site/patches/[email protected]) does two things:aria-selectedprop now wins over cmdk's value.data-selected, which still tracks the highlight, instead ofaria-selected.Each picker that shows a check mark now passes its chosen state:
ComboboxItem(allSelectFilterfilters),Autocomplete,OrganizationAutocomplete,ModelSelector, the Agents org, project, and workspace pickers, and the org switcher. InFilterCombobox, rows report whether their value is applied (defaultfalse), its lists arearia-multiselectable, and the flyout's value buttons getaria-pressed. Menus that pass nothing keep cmdk's behavior, where the highlighted row is selected.Workspace page. The workspace breadcrumb gets
aria-current="page". The Resources and History sidebar buttons, which open and close their panels, getaria-pressed. The selected resource getsaria-current.Closes DEQ-32, Closes DEQ-91, Closes DEQ-162, Closes DEQ-195, Closes DEQ-221, Closes DEQ-278, Closes DEQ-363, Closes DEQ-395, Closes DEQ-409, Closes DEQ-559
FilterCombobox)There are no visual changes, so there are no screenshots. I ran axe-core 4.11 on the affected open-menu stories on both
mainand this branch. It reported no new violations; the existingaria-dialog-name,nested-interactive, andaria-required-childrenresults show up onmaintoo. The listbox dumps match the fix. InCompactProjectSelector/Openonmain, the highlighted first row isaria-selectedand the chosen project isn't. On this branch, only the chosen project is.DEQ-572 (template builder stepper) was already fixed on
mainby #31854, so this PR doesn't touch it.Decisions, dropped review findings, and follow-ups
Why a patch. I looked at two ways to avoid it.
asChildso the child'saria-selectedwins broke keyboard navigation. cmdk finds the highlighted row with[aria-selected="true"], so Enter and the arrow keys stopped working once a chosen row stopped matching the highlighted one. The patch moves that lookup todata-selected.aria-checkedon options would leave cmdk's wrongaria-selected="true"on the highlighted row.Remove the patch once cmdk ships a release that keeps the two states separate.
Role choices on the workspace page.
aria-pressed. Clicking the active one closes its panel, so they are toggles; they don't navigate anywhere.aria-current. Clicking one selects it and never deselects it, so it is the current item in a set.Self-review. I ran
frontend-review,frontend-deep-review(all 8 roles), andfrontend-accessibility, and fixed every blocking and should-fix finding. One fix: the Create Organization row now hasaria-selected={false}, so a highlighted Create Organization row isn't announced as the selected org.Dropped findings:
aria-activedescendantinstead ofdata-selectedto find the highlight inFilterComboboxtests. I tried it. cmdk leaves the input'saria-activedescendantnull in two existing Retry tests even though a row is highlighted. That's a separate cmdk timing issue, so the tests keep usingdata-selected, the attribute cmdk documents for the highlighted item.FilterComboboxlistsaria-multiselectablewhen they hold value rows (nit). I left it on the shared list: every list in this component can apply several values at once.Follow-ups, out of scope here:
Autocomplete, used only byModelIdentifierField, setsaria-activedescendantandaria-controlsto ids that cmdk overwrites, so the highlight was never announced there. This predates the PR.MultiSelectComboboxpasses no chosen state, so cmdk still marks its highlighted row as selected. Its picked options leave the list, and Deque didn't report it..claude/docs/FRONTEND_PATTERNS.mdsays cmdk overwritesaria-selected. With this patch that's no longer true for Items. That file is outsidesite/, so it's left for a separate change.Checks.
pnpm test(whole unit suite),vitest --project=storybook(whole suite; one unrelated loading story failed once and passed on rerun),pnpm check,pnpm lint, andpnpm format.