Conversation
|
Build successful! 🎉 |
| useInteractOutside({ | ||
| ref: popoverRef, | ||
| onInteractOutside: (e) => { | ||
| if (nodeContains(buttonRef?.current, getEventTarget(e) as Element)) { | ||
| return; | ||
| } | ||
| state.close(); | ||
| }, | ||
| isDisabled: !state.isOpen | ||
| }); |
There was a problem hiding this comment.
This will cause the combobox to close its dropdown if the user clicks in the input field to move the text cursor while the input field is open, thus also clearing the input value prematurely. To reproduce, try going to https://reactspectrum.blob.core.windows.net/reactspectrum/00b9c9579f9dbff5d7f0a850d1add047a221832c/storybook-s2/index.html?path=/docs/combobox--docs, typing "Mi", then trying to click inbetween "M" and "i" to move the cursor
There was a problem hiding this comment.
Ah thanks, didn't know that was a user flow. I think we can adjust for that by checking if it's the input
There was a problem hiding this comment.
yeah I think that should be sufficient, we'll need to do some mobile screenreader testing and what not just to be sure.
Closes #5338
Also fixes an issue where a combobox inside of a shadow dom couldn't be closed by clicking outside, seen here
#9632
✅ Pull Request Checklist:
📝 Test Instructions:
In the new story
🧢 Your Project: