react-spectrum: Press seems to be double triggered for overlaying buttons on chrome simulated touch
π Bug Report
Given a dialog with a close button exactly overlaying the open button (not unusual for burger-menu-style navigation), clicking the open button with chrome simulated touch, triggers the close callback of the close button directly after the open callback (in ~90% of the cases?! π) resulting in the dialog closing immediately. (See Code Sample)
(open and close refer to statelyβs useOverlayTriggerState setters)
π€ Expected Behavior
Clicking the open button with simulated touch in chrome only triggers open.
π― Current Behavior
Clicking the open button with simulated touch in chrome triggers open, then close immediately after.
π Possible Solution
π§
π¦ Context
Weβre building a βDrawerβ component / mobile navigation where the open and close button are in the same screen location.
Itβs probably not the worst thing ever. I could not reproduce this with any form of real click or real touch input. Also Firefox simulated touch seems to work fine.
It still is kinda frustrating since chrome is our main development environment.
π» Code Sample
Here is a code sandbox showcasing the behavior.
https://codesandbox.io/s/ckmr5?file=/src/App.js
- Open the sandbox in chrome
- open devtools
- go to any touch simulated device preview
- press menu
π Your Environment
| Software | Version(s) |
|---|---|
| react-aria | 3.1.1 |
| react-stately | 3.0.1 |
| Browser | Chrome Version 87.0.4280.63 |
| Operating System | macOS 10.15.7 (19H15) |
π§’ Your Company/Team
π· Tracking Issue (optional)
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 5
- Comments: 19 (8 by maintainers)
as a workaround, I added a 200ms await on the first line of the onPress handler. So hacky, so bad. But nothing else I can do:
this is my hacky sleep function: