Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wilfredjonathanjames opened this issue Aug 27, 2024 · 0 comments
Open
Labels
issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet

Comments

@wilfredjonathanjames
Copy link

wilfredjonathanjames commented Aug 27, 2024

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,
    }),
  }}
@wilfredjonathanjames wilfredjonathanjames added the issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet label Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet
Projects
None yet
Development

No branches or pull requests

1 participant