Skip to content

fix(site): convey selected and current state to screen readers - #32020

Merged
chrifro merged 7 commits into
mainfrom
a11y/state-selected-missing-incorrect
Nov 19, 2026
Merged

chrifro merged 7 commits into
mainfrom
a11y/state-selected-missing-incorrect

Conversation

@aqandrew

Copy link
Copy Markdown
Collaborator

Note

🤖 Generated by Coder Agents on behalf of @aqandrew.

Fixes the Deque state-selected-missing-incorrect findings (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-selected on 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:

  • An Item's aria-selected prop now wins over cmdk's value.
  • cmdk now finds the highlighted row by data-selected, which still tracks the highlight, instead of aria-selected.

Each picker that shows a check mark now passes its chosen state: ComboboxItem (all SelectFilter filters), Autocomplete, OrganizationAutocomplete, ModelSelector, the Agents org, project, and workspace pickers, and the org switcher. In FilterCombobox, rows report whether their value is applied (default false), its lists are aria-multiselectable, and the flyout's value buttons get aria-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, get aria-pressed. The selected resource gets aria-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

Ticket Surface
DEQ-32 Agents: Attach workspace picker, model selector
DEQ-91 Template builder: Organization picker
DEQ-162 Workspace page: breadcrumb, Resources/History toggles, resource list
DEQ-195 Workspace sharing: user/group search
DEQ-221 AI Gateway sessions: user and provider filters
DEQ-278 Templates: user filter
DEQ-363 Audit log: resource type, action, user, organization filters
DEQ-395 Users: status filter
DEQ-409 Create user: Organization picker
DEQ-559 Workspaces: filter menu (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 main and this branch. It reported no new violations; the existing aria-dialog-name, nested-interactive, and aria-required-children results show up on main too. The listbox dumps match the fix. In CompactProjectSelector/Open on main, the highlighted first row is aria-selected and the chosen project isn't. On this branch, only the chosen project is.

DEQ-572 (template builder stepper) was already fixed on main by #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.

  • Rendering the Item asChild so the child's aria-selected wins 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 to data-selected.
  • aria-checked on options would leave cmdk's wrong aria-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.

  • Sidebar icon buttons get aria-pressed. Clicking the active one closes its panel, so they are toggles; they don't navigate anywhere.
  • Resource rows get 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), and frontend-accessibility, and fixed every blocking and should-fix finding. One fix: the Create Organization row now has aria-selected={false}, so a highlighted Create Organization row isn't announced as the selected org.

Dropped findings:

  • Use the input's aria-activedescendant instead of data-selected to find the highlight in FilterCombobox tests. I tried it. cmdk leaves the input's aria-activedescendant null in two existing Retry tests even though a row is highlighted. That's a separate cmdk timing issue, so the tests keep using data-selected, the attribute cmdk documents for the highlighted item.
  • Only mark FilterCombobox lists aria-multiselectable when 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:

  • Inline-search Autocomplete, used only by ModelIdentifierField, sets aria-activedescendant and aria-controls to ids that cmdk overwrites, so the highlight was never announced there. This predates the PR.
  • MultiSelectCombobox passes 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.md says cmdk overwrites aria-selected. With this patch that's no longer true for Items. That file is outside site/, 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, and pnpm format.

…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.
@aqandrew
aqandrew temporarily deployed to main November 10, 2026 21:09 — with GitHub Actions Inactive
@aqandrew
aqandrew temporarily deployed to main November 10, 2026 21:09 — with GitHub Actions Inactive
@linear-code

linear-code Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

…issing-incorrect

# Conflicts:
#	site/src/components/Command/Command.test.tsx
@aqandrew
aqandrew temporarily deployed to main November 14, 2026 00:10 — with GitHub Actions Inactive
aqandrew added a commit that referenced this pull request Nov 16, 2026
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.
@aqandrew
aqandrew marked this pull request as ready for review November 17, 2026 22:41
@aqandrew
aqandrew requested a review from a team as a code owner November 17, 2026 22:41
@aqandrew
aqandrew temporarily deployed to main November 17, 2026 22:41 — with GitHub Actions Inactive
@aqandrew
aqandrew requested review from jakehwll and jeremyruppel and removed request for a team November 17, 2026 22:42
…issing-incorrect

# Conflicts:
#	site/pnpm-lock.yaml
#	site/pnpm-workspace.yaml
@aqandrew
aqandrew temporarily deployed to main November 17, 2026 22:48 — with GitHub Actions Inactive

@chrifro chrifro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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 Storybook check fails on this head. OrganizationAutocomplete.stories.tsx:85 (SelectedOptionNotHighlighted, added on main in #32012 and merged in here) waits for the highlighted MockOrganization2 row to have aria-selected="true". This PR now sets aria-selected from 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.yaml conflicts with main. #32301 removed the minimumReleaseAgeExclude block that sits next to the new patchedDependencies block. See the inline comment.

Nits (optional):

  • FilterCombobox/primitives.tsx:330,357: aria-multiselectable on every FilterComboboxList, combined with the aria-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 props rather than ??.
  • FilterCombobox/primitives.tsx:329: the comment mostly restates aria-multiselectable. Likewise, FilterCombobox.test.tsx:188-189 repeats the aria-selected contract that FilterComboboxItem'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-1057 and WorkspacePage.test.tsx:459-501 are bare findByRole/getByRole calls with pressed/current/selected. An explicit expect(...).toHaveAccessibleName(...) would make clear which calls assert.
  • Autocomplete.test.tsx:82: the new it.each sits outside describe(Autocomplete.name).
  • .claude/docs/FRONTEND_PATTERNS.md still says cmdk overwrites aria-selected. That needs a follow-up PR outside site/.

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.

Comment thread site/pnpm-workspace.yaml Resolved
@chrifro
chrifro marked this pull request as draft November 18, 2026 10:38
…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
@aqandrew
aqandrew marked this pull request as ready for review November 19, 2026 05:14
@aqandrew
aqandrew requested a review from chrifro November 19, 2026 05:14

@chrifro chrifro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

@chrifro
chrifro merged commit 964ceed into main Nov 19, 2026
33 checks passed
@chrifro
chrifro deleted the a11y/state-selected-missing-incorrect branch November 19, 2026 10:18
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 19, 2026

This branch had an error being deployed

1 failed and 1 inactive deployments
docs-preview — d583eb0f Deployed Nov 19, 2026 by chrifro via cleanup #251
main — d583eb0f Deployed Nov 19, 2026 by chrifro via cla #260132
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants