downshift-js / downshift-js/downshift

Usage Example - Multiple select combo box with shift click/enter for group selection

Open
#1,499 1 comment 0 reactions 0 assignees View on GitHub
docs
Dominant language
JavaScript
Stars
12.3k
Forks
936
PR merge metrics
No merged PRs in 30d

Description

I wanted to suggest adding this usage example to the doc site. It covers how to add functionality for the user to do group selection using the shiftKey modifier on the item enter and click events. I hope it's a good example of how to use customized event handlers. Also, it shows another integration of the useMultipleSelection hook. Here is the code pen link https://codesandbox.io/s/cold-dawn-vv5w5j

As a side note or question, I wonder if it would make sense to expose the shift modifier key in the reducer for these events or send the event to the reducer as a whole. This would allow the handling of this kind of interaction in the reducer or possibly the onStateChange function. I notice the alt key is being tracked for some of the arrow key presses maybe the shift could be added for the enter and click events. Just a thought I know it's only one use case but it would streamline this implementation and may be useful for others. I could submit a PR for that if you think it would be reasonable.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.