Skip to content

fix(selector): hasSearch input is the combobox with aria-activedescendant (comboboxes-4) - #3402

Merged
cixzhang merged 1 commit into
mainfrom
navi/fix/selector-hassearch-combobox
Jul 2, 2026
Merged

cixzhang merged 1 commit into
mainfrom
navi/fix/selector-hassearch-combobox

Conversation

@cixzhang

@cixzhang cixzhang commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Part of the accessibility & keyboard-management program (#3343). Fixes finding comboboxes-4.

Problem

In hasSearch mode, Selector/MultiSelector move focus into the popup's search input on open — but that input was a bare role="searchbox" with only aria-controls and an aria-label. The aria-activedescendant that reports the highlighted option stayed on the trigger, which no longer had focus. So a screen-reader user typing to filter heard nothing as ArrowUp/Down moved the highlight: the attribute reporting the highlight was on an element they had left.

Fix

The search input is now the combobox (APG combobox-with-listbox-popup):

  • role="combobox", aria-expanded, aria-autocomplete="list", aria-controls={listbox}, and aria-activedescendant pointing at the highlighted option — so highlight changes are announced on the focused element.
  • To avoid two comboboxes in the tree, the trigger becomes a plain <button> (keeping aria-haspopup="listbox" / aria-expanded to open the popup) when hasSearch is set; it stays role="combobox" in the default (no-search) mode where the trigger itself hosts the value and activedescendant.
  • Arrow keys / Enter / Escape / Tab still propagate from the input to the shared combobox keyboard handler; Home/End (and Space in MultiSelector) are left to the input for caret/typing.

Tests

Selector + MultiSelector hasSearch tests updated to reflect the trigger-is-a-button / search-input-is-combobox structure, plus a new assertion that the search input carries aria-autocomplete="list", aria-expanded, aria-controls, and gains aria-activedescendant after ArrowDown. Full Selector + MultiSelector suites green (67 tests), typecheck (incl. tests) + lint clean.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 2, 2026
@vercel

vercel Bot commented Jul 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview, Comment Jul 2, 2026 9:34am

Request Review

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.6KB 0B

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@nynexman4464 nynexman4464 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor thing I noticed here. In the accessibility tree view I noticed the role switches from "button" to "combobox" on enter. I checked a few other searchable, which had role "combobox" to start. I guess maybe because in this case we had the "clear" button the combobox role doesn't work well (actually I think we may have talked about this once before).

Image Image

Anyhow I tested with keyboard and saw the active descendant etc seem to be updating appropriately, arrow keys work, enter and esc work.

One bug with multi-selector: using arrow keys didn't scroll the active item into view. Would be nice to fix (could be a different PR):

Screen.Recording.2026-07-02.at.12.07.59.PM.mov

Another minor nit: we don't currently show a searchable example on the Selector doc page. Might be a nice add.

@cixzhang
cixzhang merged commit ac17c7f into main Jul 2, 2026
15 checks passed
@github-actions
github-actions Bot deleted the navi/fix/selector-hassearch-combobox branch July 12, 2026 06:58

This branch was successfully deployed

1 active deployment
Preview — e36bda5d Deployed Jul 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants