Repository navigation
fix(combobox): set aria-controls on the combobox element while open - #3289
Merged
Merged
Conversation
6 of 13 tasks
Niznikr
previously approved these changes
Nov 10, 2026
The SLDS markup puts role="combobox" on the .slds-combobox wrapper and role="textbox" on the input, but aria-controls was only set on the input. An expanded role="combobox" without aria-controls fails axe aria-required-attr (W-24839159). Set aria-controls on the wrapper in all six render paths: the listbox id for base, inline-listbox and readonly, and the dialog id (following any id set through popover props) for variant="popover". It is set only while the target is rendered, and the input uses the same value.
The `.slds-combobox` wrapper had role="combobox" with aria-expanded,
aria-haspopup, aria-controls and aria-owns (the ARIA 1.1 pattern), and
the input was role="textbox". The SLDS blueprint and ARIA 1.2 put
role="combobox", aria-expanded, aria-haspopup and aria-controls on the
focusable input, with the wrapper presentational.
Move them to the input in all six render paths and drop aria-owns.
aria-expanded follows the rendered listbox, so it is false while
disabled. aria-autocomplete="list" stays only on the autocomplete
variants (base, inline-listbox); readonly and popover take no typed
input.
axe reports no aria-required-attr violation in any variant, open or
closed.
BREAKING CHANGE: role="combobox" and its aria-expanded, aria-haspopup
and aria-controls are on the input, not the .slds-combobox wrapper, and
the wrapper no longer sets aria-owns. Queries such as
getByRole('combobox') now return the input.
interactivellama
force-pushed
the
fix/combobox-aria-controls
branch
from
November 11, 2026 07:17
f9f57f5 to
539af51
Compare
Niznikr
approved these changes
Nov 11, 2026
7 of 15 tasks
interactivellama
added a commit
that referenced
this pull request
Nov 20, 2026
Add axe-core and a shared `expectNoAxeViolations()` helper for the browser project, where the real SLDS stylesheet is loaded. Run it on the open or expanded state of Combobox (every variant), MenuDropdown, Popover, Tooltip, DatePicker, Modal, Accordion, ExpandableSection, Tree (expanded branches) and ColorPicker. Closed, axe can't see the popup and exempts `aria-expanded="false"` from `aria-controls`, and story snapshots render closed, which is how the Combobox `aria-controls` bug (#3289) shipped. Removing `aria-controls` from Combobox fails all six open-state Combobox tests. Two rules are disabled for one render each, with the reason in the test: - Tree, `label-content-name-mismatch`: axe counts an expanded branch's child group as its visible text, so flags the branch `aria-label` that keeps the children out of its name. The test asserts the names. - DatePicker, `target-size`: the calendar button is the SLDS `slds-input__icon` blueprint, sized at 0.875rem by SLDS. The calendar itself is checked with every rule on.
interactivellama
added a commit
that referenced
this pull request
Nov 20, 2026
Add axe-core and a shared `expectNoAxeViolations()` helper for the browser project, where the real SLDS stylesheet is loaded. Run it on the open or expanded state of Combobox (every variant), MenuDropdown, Popover, Tooltip, DatePicker, Modal, Accordion, ExpandableSection, Tree (expanded branches) and ColorPicker. Closed, axe can't see the popup and exempts `aria-expanded="false"` from `aria-controls`, and story snapshots render closed, which is how the Combobox `aria-controls` bug (#3289) shipped. Removing `aria-controls` from Combobox fails all six open-state Combobox tests. Two rules are disabled for one render each, with the reason in the test: - Tree, `label-content-name-mismatch`: axe counts an expanded branch's child group as its visible text, so flags the branch `aria-label` that keeps the children out of its name. The test asserts the names. - DatePicker, `target-size`: the calendar button is the SLDS `slds-input__icon` blueprint, sized at 0.875rem by SLDS. The calendar itself is checked with every rule on.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes W-24839159
Additional description
Symptom: with the Combobox menu open, axe reports
aria-required-attr: the element withrole="combobox"hasaria-expanded="true"but noaria-controls. Reproduces on master (11.0.0-alpha.10) and on 0.10.65.Root cause: the markup put
role="combobox"on the.slds-comboboxwrapper androle="textbox"on the input (the ARIA 1.1 pattern).aria-controlswas only set on the input, which isn't the element axe checks for the combobox's required attributes. This applies to all six render paths: base, inline-listbox single and multiple, readonly single and multiple, and popover. The story snapshots didn't catch it because axe exemptsaria-expanded="false"and the stories render closed.Fix: two commits.
fix(combobox): set aria-controls on the combobox element while open. Setsaria-controlson therole="combobox"element while the popup is rendered:${id}-listboxfor the listbox variants, and${popoverId}-popoverfor popover (follows anidset throughpopoverprops).fix(combobox)!: put the combobox role and state on the input (ARIA 1.2). Breaking. Follows the ARIA 1.2 combobox pattern and the SLDS blueprint:role="combobox",aria-expanded,aria-haspopupandaria-controlsmove from the.slds-comboboxwrapper to the input (.slds-combobox__input), which wasrole="textbox". The wrapper has no role and noaria-owns.aria-autocompleteis only set on the autocomplete variants (base,inline-listbox). Readonly and popover no longer set it.aria-controlsis set andaria-expandedistrueonly while the popup is rendered. The listbox renders only while open and enabled, and that check now honors the deprecatedsingleInputDisabledas well asdisabled. Before,<Combobox singleInputDisabled isOpen />pointedaria-controlsat a listbox that wasn't in the DOM.getDialoguses the same check, so the two can't drift apart.getComboboxAriaProps(popup, popupId).aria-expandedis derived from whether there's a popup id.Migration: queries such as
getByRole('combobox')now return the input, not the wrapper. Selectors or tests that target.slds-combobox[role="combobox"],role="textbox"on the input, or the wrapper'saria-expanded/aria-ownsneed updating. BothCHANGELOG.mdentries (Changed/BREAKING and Fixed) are updated.Snapshots: story snapshots change: the role and state attributes move from the wrapper to the input in every combobox story, and readonly/popover lose
aria-autocomplete.Tests: 87 combobox tests pass. New cases cover open and closed/disabled per variant, the custom popover id, the wrapper having no role or
aria-owns, andsingleInputDisabledon base and readonly. The open-state andsingleInputDisabledcases fail without the fix.TinyNod (advisory): status
findings, 3 items, all triaged as false positives: aMOCK-labelled SQL injection finding on changelog prose (CHANGELOG.md:99), bundle size on a test file, and an unspecified naming-convention note on a changelog line that matches its neighbours.The 0.10.x backport is a separate PR.
CONTRIBUTOR checklist (do not remove)
Please complete for every pull request.
Green gate — all of these must pass locally (CI runs the same):
npm run lintpasses with 0 errors (npm run lint:fixto auto-fix). Warnings are the tracked gradual-migration backlog; do not add new errors.npm run typecheckis clean (tsc --noEmit).npm test -- --runpasses — this runs both Vitest projects (jsdomunit+ real-browserbrowser) and the story HTML snapshots. If you changed rendered markup on purpose, update snapshots withnpm test -- --run -uand review the diff.npm run buildsucceeds (type-check + Vite library build +.d.ts+ entry shims).Behavior & docs:
components/button/__tests__). New props and bug fixes should get a regression test. Tests that genuinely need a real browser (focus traversal, layout/measurement, canvas) go in a*.browser.test.jsxfile (thebrowserproject); everything else is jsdom.npm run storybook→ http://localhost:6007/. Confirm the story actually renders and behaves (deprecated Storyshots/Karma are gone; there is no separate browser-tests server).content/visualPickerFigure, render props likerenderItem,iconprops,events), not assumptions — a common source of "component looks broken" reports has been stories authored against the wrong API. Cross-check againstcomponents/<name>/__examples__..d.ts(they're generated by the build); JS consumers rely on them via editor type-acquisition.REVIEWER checklist (do not remove)
CIworkflow: lint, typecheck, test, build). Chromatic visual review, if configured, has been checked.components/__tests__/__snapshots__/story-snapshots.test.jsx.snap).@salesforce/design-system-react/components/<name>and nested paths resolve for ESM, CJS, and types). Removing/renaming a public component or export is a breaking change →feat!:/BREAKING CHANGE:and a major version bump.