Repository navigation
fix(site/src): announce empty command results to screen readers - #32667
Merged
Merged
Conversation
cmdk mounts its empty message only when the list has no results, inside the listbox, so screen readers never announced "No organizations found", "No models found.", "No workspaces found" or "No users or groups found" (WCAG 4.1.3). Command now renders an sr-only status outside the listbox that is mounted before any message, and CommandEmpty copies its visible text into it while it is shown. Refs DEQ-183
bartekgatzcoder
marked this pull request as ready for review
November 24, 2026 12:25
chrifro
approved these changes
Nov 24, 2026
chrifro
left a comment
Collaborator
There was a problem hiding this comment.
The shared Command primitive now has a pre-mounted sr-only role="status" outside the listbox, and CommandEmpty copies its text into it. This covers all four remaining DEQ-183 surfaces (org, model, workspace, and user/group pickers); element 1 is already handled by FilterCombobox's own status region. Nits: a virtual-cursor user may hear the empty text twice (visible and sr-only copies), and the getAllByRole("link")).toHaveLength(1) count assertion is borderline TS2, but it guards a real a11y property. Follow-up filed: DEQ-651 (MultiSelectCombobox has its own local CommandEmpty and is not covered).
🤖 Generated by Coder Agents on behalf of @chrifro.
chrifro
had a problem deploying
to
docs-preview
November 24, 2026 12:44 — with
GitHub Actions
Failure
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Screen readers did not announce the "No ... found" messages in cmdk pickers (WCAG 4.1.3 Status Messages). cmdk mounts
Command.Emptyonly when the list has no results, withrole="presentation"inside thelistbox, so there was no live region to announce it.Commandnow renders ansr-onlyrole="status"span next to the listbox. It is mounted before any message appears, and it sits outside the listbox because a status is not an allowed child there.CommandEmptycopies its visible text into that span while cmdk shows it, keeps the copy in sync with aMutationObserver, and clears it on unmount. Only text is copied, so a link inside an empty message (for example inWorkspacesButton) never gets a hidden, focusable duplicate. Nothing changes visually.Closes DEQ-183
FilterComboboxalready announces this through its own live regionCompactOrgSelector→CommandEmptyModelSelector→CommandEmptyAgentChatInput→CommandEmptyAutocomplete→CommandEmptyThe fix is in the shared primitive, so every other
CommandEmptyandComboboxEmptycaller (for exampleSelectFilter,OrganizationAutocomplete,WorkspaceUserAutocomplete) is announced too.The empty text now appears twice in the DOM (visible copy and
sr-onlycopy), so three story play functions that usedgetByTexton it were changed to wait only, without assertions. The new Vitest test inCommand.test.tsxcovers the announcement.No screenshots: the change is not visible.
Decision log and review notes
CommandEmptyprimitive, so this is one PR (43 non-test lines).Commandroot and only its text changes.statuschild insiderole="listbox"breaksaria-required-children.children: the first version portaledchildreninto the status. Self-review found that this duplicates interactive content (theWorkspacesButton"Create one now." link) as a hidden tab stop. The test now puts a link in the message and asserts that there is still only one link.useCallback:components/is not compiled by the React Compiler. A stable ref identity stops every keystroke from clearing and rewriting the live region.CommandEmptyno longer accepts aref, so a caller cannot silently replace the mirror. No caller passes one.aria-dialog-nameon the Radix popover andaria-required-childrenon the empty cmdk listbox, on both base and branch.MultiSelectComboboxhas its own localCommandEmptyand is not covered. If a list is already empty when its popover opens, the region and its text mount together and may not be announced; every case in the ticket happens after typing.OrganizationModelsLayout.stories.tsx > Loadingis flaky onmaintoo (1 of 5 runs failed on base). It is unrelated.🤖 Generated by Coder Agents on behalf of @bartekgatzcoder.