JedWatson / JedWatson/react-select
[Accessibility] No class added to `multi-value` on keyboard nav
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 28k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
Bug
Behaviour
Selects with unstyled isMulti classNamePrefix="prefix" do not set *--is-focused or *--is-selected classes on multi-value components when keyboard navigating.
The isFocused flag works as expected when using the style={{multiValue: ...}} prop. However for those of us using css files this method requires splitting styles between inline and file, which has a negative impact on readability.
Expected behaviour
Set *--is-focused, *--is-selected or similar on multi-value elements and their children when keyboard navigating.
Version
react-select@5.8.0
Code
<ReactSelect
unstyled
isMulti
classNamePrefix="prefix"
defaultValue={["Test One", "Test Two"].map(v => ({
value: v,
label: v,
}))}
/>
Repro
- Focus the input and press the left arrow key to select a default option. With devtools open, notice that no class is added or changed on
multi-valueelements. - Remove the
unstyledprop and repeat the previous step. Notice that a blush is added to the remove button of keyboard navigatedmulti-values. - Replace the
unstyledprop and add the followingstylesprop. Notice that react-select sets the background on keyboard navigation correctly
styles={{
multiValue: (baseStyles, { isFocused }) => ({
background: isFocused ? "tomato" : "",
...baseStyles,
}),
}}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the provided ReactSelect example with unstyled, isMulti, and classNamePrefix, then compare keyboard navigation with the styled and styles.multiValue cases. Trace how multi-value elements and their children receive classes during keyboard navigation. Done means the relevant focused or selected class is present while navigating, including for unstyled selects.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- accessibility, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100