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

When using useMultipleSelection with either useSelect aria updates for adding items don't work #1298

Open
AndrewSwerlick opened this issue Jul 29, 2021 · 1 comment
Labels

Comments

@AndrewSwerlick
Copy link

AndrewSwerlick commented Jul 29, 2021

  • downshift version: 6.0.5
  • node version: 10.20.1
  • npm (or yarn) version: (unsure, can replicate in code sandbox)

Relevant code or config

Can replicate in this code sandbox example https://codesandbox.io/s/github/kentcdodds/downshift-examples?file=/src/hooks/useMultipleSelection/select.js

What you did:

Use the example above to select multiple items.

What happened:

No aria-live messages showed up when adding items to the selection. Aria-live messages only showed up when removing items.

Reproduction repository:

https://codesandbox.io/s/github/kentcdodds/downshift-examples?file=/src/hooks/useMultipleSelection/select.js

Problem description:

I would expect that aria live messages show up both when adding items to a selection, and removing them. Interestingly, if I comment out lines 39 and 40 in the onStateChange function the message starts to show up

    onStateChange: ({type, selectedItem}) => {
      switch (type) {
        case useSelect.stateChangeTypes.MenuKeyDownEnter:
        case useSelect.stateChangeTypes.MenuKeyDownSpaceButton:
        case useSelect.stateChangeTypes.ItemClick:
        case useSelect.stateChangeTypes.MenuBlur:
          if (selectedItem) {
            //addSelectedItem(selectedItem)
            //selectItem(null)
          }
          break
        default:
          break
      }
    },

So something about calling those two mutative functions messes up the code that detects that an aria update is required.

Suggested solution:

Unsure, I dug around in those functions but couldn't identify anything obvious

@silviuaavram
Copy link
Collaborator

The status part needs to be reimplemented. Will keep this open for tracking.

@silviuaavram silviuaavram mentioned this issue Dec 19, 2022
Closed
10 tasks
@silviuaavram silviuaavram mentioned this issue Jul 15, 2023
Closed
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants