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

Screen readers read out object code when using useMultipleSelection hook #1594

Open
jamesryan-dev opened this issue Apr 17, 2024 · 2 comments

Comments

@jamesryan-dev
Copy link

  • downshift version: ^7.6.0 ( but bug also occurs on your example page via your docs )
  • node version: ^18
  • npm (or yarn) version: ^9

Relevant code or config

But if present here in your docs so I have only included this:

https://www.downshift-js.com/use-multiple-selection/

What you did:

  • Using a screen reader
  • Remove one of the items

We are using the removeSelectedItem function which is causing this screen reader issue I believe

What happened:

You will hear, "[object, object] has been removed"

Problem description:

Screen readers are reading out code

Suggested solution:

I'm not sure sorry

@jamesryan-dev
Copy link
Author

any updates on this?

@ApplyBoardDak
Copy link

this also happens on Downshift v8. the removeSelectedItem will read [object object] if useMultipleSelection uses an object as its type instead of a string. in v7 and v8 you can get around this by implementing getA11yRemovalMessage like so:

  const { getSelectedItemProps, getDropdownProps, removeSelectedItem, reset } =
    useMultipleSelection<OptionWithGroup>({
      getA11yRemovalMessage: (options) => {
        return `${options.removedSelectedItem.label} has been removed`
      },
      ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants