Registry Mirror
Skip to content

Conversation

@dreamwasp

@dreamwasp dreamwasp commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Non-searchable SelectDropdown (isSearchable={false}) now follows the ARIA APG select-only combobox pattern. react-select renders a hidden <input role="combobox"> in that mode, which VoiceOver and NVDA announce as editable ("Type text…", "auto complete").

Changes

  • The ValueContainer is the combobox: role="combobox", tabIndex=0, aria-haspopup, aria-expanded, aria-controls, aria-activedescendant, aria-required (from required), and the label props. Consumer inputProps.combobox overrides are applied last.
  • react-select's hidden input is disabled, aria-hidden, has no role, and has tabIndex=-1.
  • Mousedown toggles the menu through the select instance ref, and focus stays on the trigger.
  • The menu closes only when focus leaves the whole select. Focus moving within the select (menu or hidden input) doesn't dismiss it.
  • The active option is read from the rendered menu (aria-selected). react-select omits aria-activedescendant on Apple devices (isAppleDevice).
  • The public id is on the trigger. react-select's container doesn't get it in this mode, so <label htmlFor> targets the combobox.
  • Focus styling uses :focus-within on the control, and the trigger's outline is removed.
  • Gamut's focus announcement is disabled in this mode.

Searchable selects are unchanged. aria-required on the searchable input already came from react-select.

Testing

Unit: npx jest packages/gamut/src/Form (172 passing). The new cases are in the select-only combobox (isSearchable false) block. They cover roles and state, the disabled hidden input, the public id, consumer aria overrides, mouse and keyboard open and selection, and the onChange value for both.

Storybook: open Atoms / FormInputs / SelectDropdown / Default. Use the Controls panel to set isSearchable and required, then run through the steps below in each combination. The Form Group Select Dropdown story is also required, so its label shows the asterisk.

  • Keyboard: Tab to focus, Down or Space to open, Down to move, Enter to select.
  • Mouse: click opens, clicking an option selects, clicking the label focuses the select.
  • Dark mode: repeat the keyboard steps.

VoiceOver (macOS): expect "combo box, pop up, collapsed" on focus, each option announced as it becomes active, and the chosen value on Enter. Focus on a required select should be announced as required. There should be no "Type text" or "You are currently focused on option…".

Checklist

  • Related to designs:
  • Related to JIRA ticket: GMT-1874
  • Version plan added (gamut: patch)
  • Verified in VoiceOver (pending)
  • Unit tests included
  • Testing instructions included
  • Alpha passing end-to-end tests in dependent repos

PRs

With isSearchable={false}, react-select renders a hidden input with role=combobox, which screen readers announce as editable ("type text", "auto complete"). The ValueContainer is now the combobox (ARIA APG select-only pattern), and react-select's keyboard handling still applies because keydown bubbles to its container.

- Trigger: role=combobox, tabIndex 0, aria-haspopup/expanded/controls/activedescendant, label props, consumer combobox props.
- Hidden input is disabled, aria-hidden, and has no role, so it can't take focus.
- Mousedown opens/closes the menu through the select instance ref.
- Active option is read from the rendered menu (aria-selected), because react-select omits aria-activedescendant on Apple devices.
- Public id stays on the combobox so <label htmlFor> works; react-select's container no longer takes it in non-searchable mode.
- Focus style moves to the control via :focus-within.
- Gamut focus announcement is off in non-searchable mode.
@nx-cloud

nx-cloud Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 32baf83


☁️ Nx Cloud last updated this comment at 2026-12-01 17:56:15 UTC

@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.56522% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.02%. Comparing base (d70e42f) to head (32baf83).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...ut/src/Form/SelectDropdown/elements/containers.tsx 94.25% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3443      +/-   ##
==========================================
- Coverage   91.33%   91.02%   -0.32%     
==========================================
  Files         407      277     -130     
  Lines        6882     6026     -856     
  Branches     2247     2047     -200     
==========================================
- Hits         6286     5485     -801     
+ Misses        587      532      -55     
  Partials        9        9              
Flag Coverage Δ
main ?
pull-request 91.02% <94.56%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dreamwasp
dreamwasp marked this pull request as ready for review November 18, 2026 15:48
@dreamwasp
dreamwasp requested a review from a team as a code owner November 18, 2026 15:48
@LinKCoding
LinKCoding requested a balanced review from Copilot November 18, 2026 16:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved non-searchable select regressions break label association, focus and blur behavior, portaled-menu accessibility, and preservation of explicit IDs.

7 open issues
What changed in this PR

This PR changes Gamut’s non-searchable SelectDropdown to use a select-only combobox trigger, aiming to prevent screen readers from announcing it as editable text.

Changes:

  • Moves combobox semantics and focus to the value container, disables the hidden input, and tracks the active option.
  • Updates focus styling and required-state Storybook examples.
  • Adds interaction and accessibility-attribute tests plus a patch version plan.
File Description
packages/​styleguide/​src/​lib/​Atoms/​FormInputs/​SelectDropdown/​SelectDropdown.stories.tsx Adds required-state controls and a required FormGroup example.
packages/​gamut/​src/​Form/​SelectDropdown/​types/​internal.ts Adds the trigger ID to shared context.
packages/​gamut/​src/​Form/​SelectDropdown/​SelectDropdown.tsx Updates IDs, tab order, and focus announcements for non-searchable selects.
packages/​gamut/​src/​Form/​SelectDropdown/​elements/​containers.tsx Implements the select-only trigger, menu interactions, and ARIA synchronization.
packages/​gamut/​src/​Form/​SelectDropdown/​core/​styles.ts Adds control-level focus styling and removes the trigger outline.
packages/​gamut/​src/​Form/​__tests__/​SelectDropdown.test.tsx Tests combobox attributes and mouse/keyboard selection.
.nx/​version-plans/​version-plan-1794857821017.md Records the Gamut patch release and accessibility changes.

Review effort: Balanced

syncActiveOption();

return () => observer.disconnect();
}, [inputId, isSearchable]);

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

LGTM! I tested on Jaws as well and I no longer hear the mention of typing to select an option.

I'm surprised to see how much manual aria-* settings we need to do for react-select. I wonder if there's something we can look into when transitioning into 'combobox'

and lastly, just left some comments about robo-comments, but I stopped because it's very subjective.

useLayoutEffect(() => {
if (isSearchable !== false || !inputId) return;

/* Look the trigger up from the hidden input: the public id is shared with other elements. */

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.

This comment seems more confusing than it is helpful, e.g. how is an id shared with other elements?

would consider omitting


/* Look the trigger up from the hidden input: the public id is shared with other elements. */
const input = document.getElementById(inputId);
/* Start at the parent: closest() includes the input itself, which still has role="combobox" here. */

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.

imo, code here is self-documenting

… clicks

- Keep react-select's id layout in every mode: the consumer id (or htmlFor, or
  a generated id) goes on the SelectContainer and name goes on the input, as on
  main. The non-searchable trigger no longer takes an id; it is found from the
  hidden input.
- Name the non-searchable trigger from the label that targets the input, and
  focus the trigger when that label is clicked.
- Open and close the menu on mousedown anywhere on the control. react-select
  only opens the menu once its input has focus, and the hidden input can't take
  focus, so clicks on the control padding did nothing.
…s name

Mono passes the same value for id and name. react-select then gives the
container and the hidden input the same id, so getElementById returned
the container. The hook never hid the input's role, and each
non-searchable dropdown exposed two comboboxes.

Match the input by tag among elements with that id, and add a regression
test for id === name.
@codecademydev

Copy link
Copy Markdown
Collaborator

📬 Published Alpha Packages:

Package Version npm Diff
@codecademy/gamut 74.0.2-alpha.b25375.0 npm diff
@codecademy/gamut-icons 10.2.1-alpha.b25375.0 npm diff
@codecademy/gamut-illustrations 1.1.1-alpha.b25375.0 npm diff
@codecademy/gamut-kit 3.0.29-alpha.b25375.0 npm diff
@codecademy/gamut-patterns 1.1.1-alpha.b25375.0 npm diff
@codecademy/gamut-styles 21.2.1-alpha.b25375.0 npm diff
@codecademy/gamut-tests 7.1.1-alpha.b25375.0 npm diff
@codecademy/variance 1.1.1-alpha.b25375.0 npm diff
eslint-plugin-gamut 3.1.1-alpha.b25375.0 npm diff

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants