-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Provide a general summary of the feature here
Currently useSelectState
will auto close the select when an option is selected. In one of our design system components we need to allow the user to select a value, and then click a confirmation button to confirm the selection, but that is not possible without hacks.
🤔 Expected Behavior?
We would like to opt-out of auto closing the popover (or useSelectState could take the useOverlayTriggerState value as a prop and we could hook into it there)
😯 Current Behavior
react-spectrum/packages/@react-stately/select/src/useSelectState.ts
Lines 52 to 59 in 8326f90
onSelectionChange: (key) => { | |
if (props.onSelectionChange != null) { | |
props.onSelectionChange(key); | |
} | |
triggerState.close(); | |
validationState.commitValidation(); | |
} |
when a value is selected the popover is closed.
💁 Possible Solution
Ideally just a prop to opt-out of this behaviour. I've attached our current workaround, which just involves a ref and hooking into callbacks and ignoring them, but it feels a bit nasty.
🔦 Context
Here is how we've solved it for now:
💻 Examples
This is the component we want to build:
🧢 Your Company/Team
Flowcase
🕷 Tracking Issue
No response