Conversation
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.
|
View your CI Pipeline Execution ↗ for commit 32baf83 ☁️ Nx Cloud last updated this comment at |
Codecov Report❌ Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 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
Preserve explicit id in non-searchable mode · New Route programmatic focus to the trigger and sync focus state · New Resolve and observe portaled listbox options · New Reapply input suppression when disabled state changes · New Close the menu when focus leaves the select boundary · New Restore label association and click-to-focus behavior · New Bridge trigger focus and blur to react-select lifecycle · New
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
left a comment
There was a problem hiding this comment.
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. */ |
There was a problem hiding this comment.
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. */ |
There was a problem hiding this comment.
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.
|
📬 Published Alpha Packages:
|
|
🚀 Styleguide deploy preview ready! Preview URL: https://6b0f0afe267b60552a028f93--gamut-preview.netlify.app |

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
role="combobox",tabIndex=0,aria-haspopup,aria-expanded,aria-controls,aria-activedescendant,aria-required(fromrequired), and the label props. ConsumerinputProps.comboboxoverrides are applied last.disabled,aria-hidden, has no role, and hastabIndex=-1.aria-selected). react-select omitsaria-activedescendanton Apple devices (isAppleDevice).idis on the trigger. react-select's container doesn't get it in this mode, so<label htmlFor>targets the combobox.:focus-withinon the control, and the trigger's outline is removed.Searchable selects are unchanged.
aria-requiredon the searchable input already came from react-select.Testing
Unit:
npx jest packages/gamut/src/Form(172 passing). The new cases are in theselect-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 theonChangevalue for both.Storybook: open
Atoms / FormInputs / SelectDropdown / Default. Use the Controls panel to setisSearchableandrequired, then run through the steps below in each combination. TheForm Group Select Dropdownstory is alsorequired, so its label shows the asterisk.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
gamut: patch)PRs