downshift-js / downshift-js/downshift
Expose alternative `InputBlur`-like event for use with `useMultipleSelection`
- Dominant language
- JavaScript
- Stars
- 12.3k
- Forks
- 936
- PR merge metrics
- No merged PRs in 30d
Description
- `downshift` version: v6
Feature request:
downshift [attaches event listeners](https://github.com/downshift-js/downshift/blob/ba0ec8a51f3ee60d52b90122fc3efa7e26532160/src/hooks/utils.js#L305-L382) to the document to trigger the `InputBlur` event when the the user clicks outside of the downshift menu element when the menu is open. I'd like to request a similar event to be triggered for use with `useMultipleSelection`.
Here's my usecase: I have a multiple selection with different styles for the currently active selected item. I'd like to be able to reset this when the user clicks outside the menu, so anytime the user clicks outside of the menu elements I'd call something like `setActiveIndex(-1)`. The `InputBlur` event does not trigger in this case as the menu is not open, so I'm unable to call `setActiveIndex(-1)` during `InputBlur`. I feel that this is a common enough use case that this could be integrated within `useMultipleSelection`.
Contributor guide
Assessment
This issue has not been assessed yet.