-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Menu/Select pick immediately when Popover overlaps its Trigger #3864
Comments
Thanks for reporting this. We don't want to move to pointerDown selecting the item and closing the menu. That wouldn't match native controls. I think we should instead ignore the pointerUp that follows opening the menu. But to match native, there's a timeout where if you hold the mouse down, then lifting will immediately select and close. |
Just some more investigation notes for posterity: I had thought that we could leverage some of the |
I believe I'm experiencing the same bug in my popover components, but there might be something more going on than what meets the eye.
The Firefox bug is present in your tailwind example of select component: To reproduce, open Codesandbox project in a new window, then press I was not able to reproduce the Chrome bug in this example. My implementation of select (where I found the bug), might be a little different from the example though. For example, mine renders I'll try to make reproducible example in the following days |
I followed your steps to reproduce in FF with that codesandbox, I'm noticing that the options take a moment to show up, but I do not notice the menu closing on its own. I'm on FF 109 in MacOS 13.1 |
@snowystinger I'm on FF 109 in windows 10 |
Reproduced in Windows Firefox 109 w/ touch emulation and on Android Firefox 108 |
I really want to emphasize the bug is present in regular popovers and not just pickers. That said, I think I found the source of the bug. When you render an underlay in a popover and the underlay is drawn on top of the application something causes the popover to close. Note, if underlay is hidden thru The reason why the bug happens in the select example, is the missing prop If this is a feature would you please provide the reasoning behind the Although there's use cases for underlays always rendering inside the popover, like being able to change popover to bottom sheet on mobile with css |
Just checked and @sebald's original bug is still there even with underlay gone, so I was wrong in believing that these things were related |
The reason for the |
🐛 Bug Report
When there is not enough space for the popover to be placed above/below its trigger, it will overlap the trigger. This causes the popover to be immediately closed and whatever item is underneath the pointer will be selected.
🤔 Expected Behavior
Items should not automatically be selected.
😯 Current Behavior
💁 Possible Solution
The issue is caused by conflicting event handlers. The popover opens on
onPointerDown
and the selection event for both, the menu and select (listbox), happens ononPointerUp
. One possible solution might be to move the selection to another event, e.g.onPointerDown
.A temporary fix is the following:
💻 Code Sample
Codesandbox Playground: https://codesandbox.io/s/shy-paper-fi7w0f?file=/src/App.js
To see the behavior, reduce the size of the browser.
🌍 Your Environment
The text was updated successfully, but these errors were encountered: