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

Dropdown NextItem Components Do Not Work Properly When Passed Object Values #816

Closed
louisscruz opened this issue Jul 21, 2020 · 1 comment · Fixed by #817
Closed

Dropdown NextItem Components Do Not Work Properly When Passed Object Values #816

louisscruz opened this issue Jul 21, 2020 · 1 comment · Fixed by #817

Comments

@louisscruz
Copy link
Contributor

louisscruz commented Jul 21, 2020

Expectations

All NextItem components that are passed objects as values should be selectable.

Reality

Only the final NextItem component works with arrow keys when the value is a passed object.

In debugging why this behavior was happening for Zendesk Support, this caught my eye:

image

The line of code is here:

(nextItemsHashRef.current as any)[value] = itemIndexRef.current;

The key in the object should be run through the passed itemToString downshift prop, if passed.

Steps to Reproduce

  1. Have a menu with several "NextItem" components in it where each value is an object of some kind.
  2. Try to use the right arrow key to move into anything but the last NextItem – this does not work
  3. Try to use the right arrow key to move into the last NextItem – this does work

In this sandbox, open the menu and notice the difference in behavior when hitting the right arrow key for the first item and the last:

https://codesandbox.io/s/serene-gould-tg21y

Fine Print

  • Component: dropdowns
  • Version: tested on latest v7 + latest v8
  • Browsers: all
@louisscruz
Copy link
Contributor Author

Thanks @Austin94 ! Latest version confirmed to fix this!

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

Successfully merging a pull request may close this issue.

1 participant