Skip to content

fix(site/src): give cmdk search inputs an accessible name - #31873

Merged
bartekgatzcoder merged 2 commits into
mainfrom
a11y/form-label-missing
Nov 10, 2026
Merged

bartekgatzcoder merged 2 commits into
mainfrom
a11y/form-label-missing

Conversation

@jeremyruppel

@jeremyruppel jeremyruppel commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

cmdk's Command root renders a visually hidden <label> from its label prop, and it always points the search input's aria-labelledby at that label. If label is missing, the label is empty, so the input has no programmatic name. Deque flagged three of these search fields. Any aria-label on the input is ignored whenever the root label has text.

This sets the root label on every Command and ComboboxContent that renders a search input:

  • ComboboxContent forwards a new label prop to Command.
  • SelectFilter gets an optional searchLabel prop, and each filter with a search box passes one ("Search client", "Search user", and so on).
  • Autocomplete uses its placeholder as the label. That is the same text the search input shows.
  • The other call sites set label directly. On UserFilter, the organization filter, WorkspacesButton, and ModelSelector, the input aria-label moves to the root label.

Closes DEQ-81
Closes DEQ-196
Closes DEQ-376

Ticket Surface Fixed in Screenshots
DEQ-81 Workspace sharing modal, "Search for user or group" Autocomplete Linear
DEQ-196 AI Gateway sessions, "Search client" / "Search model" filters SelectFilter via ComboboxContent Linear
DEQ-376 Create user, "Find organization" OrganizationAutocomplete Linear

DEQ-81 also lists the role selects in the sharing table (elements 1 and 2). main already names them Role for <name> in WorkspaceSharingForm.tsx.

Nothing changes visually. The before and after captures on Linear show the hidden label going from empty to named, through an overlay that is not part of the UI.

Dropped review finding: TN6 asked Autocomplete not to reuse placeholder as the search input's name. I kept it, because the search input shows that same placeholder, so the name matches the visible text.

Grouping and decision log
  • Root cause: all three tickets come from the same cmdk behavior: an empty root label that aria-labelledby points at. One PR fixes all of them (48 non-test lines).
  • Why the root label and not an input aria-label: cmdk sets aria-labelledby after spreading props, so callers cannot override it. An input aria-label only works through the accname fallback for an empty aria-labelledby, and it leaves the empty <label for> that Deque flagged in place. The cmdk label prop is the documented API, and CompactProjectSelector already uses it.
  • Scope: I fixed every CommandInput/ComboboxInput call site, not just the three ticket surfaces, so this bug class is closed out.
  • SelectFilter.searchLabel: I first reused SelectFilter.label. Review pointed out that this would name the search box "Select client" while it shows "Search client...", the same name as the trigger. A separate prop keeps the name in line with the visible text.
  • axe in Storybook (axe-core 4.11): on main, the cmdk label is empty in SelectFilter/WithSearch, Autocomplete/Default, and OrganizationAutocomplete/ManyOrgs. On this branch it holds the expected text. Two violations remain on elements this PR does not touch and also show up on main: aria-dialog-name on the Radix popover and button-name on the OrganizationAutocomplete story trigger.
  • Self-review: frontend-review, frontend-deep-review (8 roles), and frontend-accessibility all pass with no remaining blocking or should-fix findings.

🤖 Generated by Coder Agents on behalf of @jeremyruppel.

cmdk points each search input's aria-labelledby at a hidden label filled
from the Command root's label prop. Without it the label is empty, so
the input has no programmatic name. Set the root label on every Command
and ComboboxContent that renders a search input.

Closes DEQ-81, DEQ-196, DEQ-376.
@linear-code

linear-code Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

DEQ-196

DEQ-376

DEQ-81

@jeremyruppel
jeremyruppel marked this pull request as ready for review November 6, 2026 21:39
@jeremyruppel
jeremyruppel requested a review from a team as a code owner November 6, 2026 21:39
@jeremyruppel
jeremyruppel requested a review from aqandrew November 6, 2026 21:40
# Conflicts:
#	site/src/modules/aiModels/ModelSelector.tsx
@jeremyruppel
jeremyruppel temporarily deployed to main November 10, 2026 14:38 — with GitHub Actions Inactive

@bartekgatzcoder bartekgatzcoder 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.

Setting the cmdk root label is the right fix: cmdk always points the search input's aria-labelledby at that label, so it covers DEQ-81 (Autocomplete), DEQ-196 (SelectFilter via ComboboxContent) and DEQ-376 (OrganizationAutocomplete), plus every other CommandInput/ComboboxInput call site. Unit tests, tsc and biome pass locally, and I confirmed that the "Find organization" input is now named.

Nits (non-blocking): searchLabel could be required whenever selectFilterSearch is passed, so that a future filter cannot ship an unnamed input. WorkspacesButton's name "Search workspace templates" does not contain its placeholder text "Type/select a workspace template". This label-in-name gap predates the PR. Combobox.stories.tsx:51 and :111 still render unlabeled inputs.

Follow-up filed: DEQ-622: the MultiSelectCombobox inputs in IdP sync and dynamic parameters are unnamed (cmdk overrides inputProps.id). This predates the PR.

🤖 Generated by Coder Agents on behalf of @bartekgatzcoder.

@bartekgatzcoder
bartekgatzcoder merged commit 7b43e1a into main Nov 10, 2026
27 checks passed
@bartekgatzcoder
bartekgatzcoder deleted the a11y/form-label-missing branch November 10, 2026 16:04
@bartekgatzcoder
bartekgatzcoder temporarily deployed to main November 10, 2026 16:04 — with GitHub Actions Inactive
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 10, 2026

This branch was previously deployed

1 inactive deployment
main — 7fb3a7dc Deployed Nov 10, 2026 by bartekgatzcoder via cla #253508
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