Skip to content

fix(site/src): expose organization picker as a combobox - #30402

Merged
chrifro merged 1 commit into
mainfrom
fix-org-picker-combobox-role
Oct 6, 2026
Merged

chrifro merged 1 commit into
mainfrom
fix-org-picker-combobox-role

Conversation

@chrifro

@chrifro chrifro commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

The organization picker trigger (OrganizationAutocomplete) was a plain <button> that opens a popup. It has no value, so screen readers announced only its label ("Organization") and never the selected organization. Deque flagged this on Create User (/deployment/users/create) under WCAG 4.1.2, rule custom-combobox.

This PR gives the trigger role="combobox". It follows the APG combobox pattern, which the Radix Select triggers (e.g. "Login type" on the same page) and ModelSelector already use. With the role in place:

  • The selected organization is exposed as the control's value. NVDA now says "Organization, combobox, Meridian Systems".
  • aria-expanded, aria-required, and aria-haspopup="dialog" are valid on the control. aria-required isn't allowed on a button.
  • aria-controls points at the popover through an id the component owns (useId), which jsx-a11y/role-has-required-aria-props requires.

A combobox doesn't take its accessible name from its contents. The one caller without a label, the Spend page picker shown when no organization is resolved, now passes ariaLabel="Organization" so it keeps a name. Every other caller already has a <Label htmlFor> or an ariaLabel.

Tests that queried the trigger by button role now use combobox. That includes queryByRole(...).not.toBeInTheDocument() checks, which would otherwise pass without checking anything. The OrganizationAutocomplete and CreateUserForm stories now assert the role, aria-expanded, aria-controls, and the exposed value.

Proof

The control looks the same, so here is Chromium's accessibility tree (via CDP Accessibility.getFullAXTree), which is what NVDA reads in Chrome:

Role Name Value
Before button Organization (none)
After combobox Organization Meridian Systems
Decision log
  • Approach: add the ARIA combobox role to the existing trigger instead of switching to a native <select>. That keeps the search box and avatars, and it matches the existing Radix Select and ModelSelector triggers.
  • Popup role: kept aria-haspopup="dialog" from Radix. ARIA 1.2 allows a dialog popup for a combobox, and the popover holds a search input plus a listbox.
  • Not changed: callers that put the organization name in ariaLabel (e.g. "Organization My Org") will now hear the name twice, once in the label and once as the value. ModelSelector already does this, so it's left for a follow-up to keep this PR small.
  • Not verified: manual NVDA run, and a live preview of Create User, which needs a multi-organization (Premium) license.

Validation: full Storybook suite (3,703 tests), the affected unit tests, make lint/ts, and make fmt/ts.


Generated by Coder Agents on behalf of @chrifro.

The organization picker trigger was a plain button, so screen readers
announced only its label and never the selected organization. Give it
role="combobox" so assistive technology exposes the selection as the
control's value, and label the unlabeled Spend page picker since a
combobox does not take its name from its contents.
@chrifro
chrifro marked this pull request as ready for review October 6, 2026 11:35
@chrifro
chrifro requested a review from a team as a code owner October 6, 2026 11:35
@chrifro
chrifro requested a review from aqandrew October 6, 2026 11:35
@linear-code

linear-code Bot commented Oct 6, 2026

Copy link
Copy Markdown

DEQ-498

@chrifro
chrifro merged commit 9d8de75 into main Oct 6, 2026
55 of 56 checks passed
@chrifro
chrifro deleted the fix-org-picker-combobox-role branch October 6, 2026 12:21
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 6, 2026
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