JedWatson / JedWatson/react-select

[Accessibility] No class added to `multi-value` on keyboard nav

Open
#5,951 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

issue/bug-unconfirmed
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

  1. 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-value elements.
  2. Remove the unstyled prop and repeat the previous step. Notice that a blush is added to the remove button of keyboard navigated multi-values.
  3. Replace the unstyled prop and add the following styles prop. Notice that react-select sets the background on keyboard navigation correctly
  styles={{
    multiValue: (baseStyles, { isFocused }) => ({
      background: isFocused ? "tomato" : "",
      ...baseStyles,
    }),
  }}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.