Repository navigation
fix(site/src): give cmdk search inputs an accessible name - #31873
Conversation
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.
# Conflicts: # site/src/modules/aiModels/ModelSelector.tsx
bartekgatzcoder
left a comment
There was a problem hiding this comment.
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.
cmdk's
Commandroot renders a visually hidden<label>from itslabelprop, and it always points the search input'saria-labelledbyat that label. Iflabelis missing, the label is empty, so the input has no programmatic name. Deque flagged three of these search fields. Anyaria-labelon the input is ignored whenever the root label has text.This sets the root label on every
CommandandComboboxContentthat renders a search input:ComboboxContentforwards a newlabelprop toCommand.SelectFiltergets an optionalsearchLabelprop, and each filter with a search box passes one ("Search client", "Search user", and so on).Autocompleteuses itsplaceholderas the label. That is the same text the search input shows.labeldirectly. OnUserFilter, the organization filter,WorkspacesButton, andModelSelector, the inputaria-labelmoves to the root label.Closes DEQ-81
Closes DEQ-196
Closes DEQ-376
AutocompleteSelectFilterviaComboboxContentOrganizationAutocompleteDEQ-81 also lists the role selects in the sharing table (elements 1 and 2).
mainalready names themRole for <name>inWorkspaceSharingForm.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
Autocompletenot to reuseplaceholderas 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
labelthataria-labelledbypoints at. One PR fixes all of them (48 non-test lines).aria-label: cmdk setsaria-labelledbyafter spreading props, so callers cannot override it. An inputaria-labelonly works through the accname fallback for an emptyaria-labelledby, and it leaves the empty<label for>that Deque flagged in place. The cmdklabelprop is the documented API, andCompactProjectSelectoralready uses it.CommandInput/ComboboxInputcall site, not just the three ticket surfaces, so this bug class is closed out.SelectFilter.searchLabel: I first reusedSelectFilter.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.main, the cmdk label is empty inSelectFilter/WithSearch,Autocomplete/Default, andOrganizationAutocomplete/ManyOrgs. On this branch it holds the expected text. Two violations remain on elements this PR does not touch and also show up onmain:aria-dialog-nameon the Radix popover andbutton-nameon theOrganizationAutocompletestory trigger.frontend-review,frontend-deep-review(8 roles), andfrontend-accessibilityall pass with no remaining blocking or should-fix findings.🤖 Generated by Coder Agents on behalf of @jeremyruppel.