Click events delayed by 300ms with touch simulation enabled and page has a meta viewport
Categories
(DevTools :: Responsive Design Mode, defect, P3)
Tracking
(Not tracked)
People
(Reporter: fvsch, Assigned: bradwerth)
References
(Blocks 1 open bug)
Details
Attachments
(3 files)
When using touch simulation in RDM, I'm getting a systematic 300ms delay between touchend and click events. We're supposed to only get this delay on pages without a meta viewport.
Context from https://developers.google.com/web/updates/2013/12/300ms-tap-delay-gone-away:
For many years, mobile browsers applied a 300-350ms delay between touchend and click while they waited to see if this was going to be a double-tap or not, since double-tap was a gesture to zoom into text.
(...) As of Chrome 32 (back in 2014) this delay is gone for mobile-optimized sites, without removing pinch-zooming! Firefox and IE/Edge did the same shortly afterwards, and in March 2016 a similar fix landed in iOS 9.3.
RDM tries to emulate this modern behavior in:
https://searchfox.org/mozilla-central/source/devtools/server/actors/emulation/touch-simulator.js#292
https://searchfox.org/mozilla-central/source/devtools/server/actors/emulation/touch-simulator.js#455-510
This seems buggy in current Nightly.
| Reporter | ||
Comment 1•6 years ago
|
||
Test case.
- Chrome in RDM mode fires the
clickevent just aftertouchend - Firefox in RDM mode fires the
clickevent 300ms aftertouchend
| Reporter | ||
Comment 2•6 years ago
|
||
Result in Firefox.
Using a meta viewport or not yields the same result.
| Reporter | ||
Comment 3•6 years ago
|
||
Result in Chrome DevTools. No delay between touchend and click events.
| Assignee | ||
Updated•5 years ago
|
| Assignee | ||
Comment 4•5 years ago
|
||
Botond, we need some guidance here. There's some history where we have a 300ms delay between touchend and click, to give the platform time to detect a double-tap-to-zoom. But we only apply that delay when double-tap-to-zoom is allowed. When we simulate devices in RDM, we either need to use the same event pathways as used in GeckoView, or we need to spoof our touch events to match what those pathways do. We use the same event pathway whenever we can, but this might be a case where we still need to spoof and we want to make sure we match the behavior correctly.
So, is this the correct statement for when GeckoView adds a 300ms pause between touchend and click events: GeckoView adds a 300ms delay for double-tap-to-zoom in all cases except user-scalable=no.
Comment 5•5 years ago
|
||
We add the delay whenever double-tap zoom is allowed. There are three reasons I'm aware of that double-tap zoom could be disallowed:
- Zooming in general is disallowed, via
user-scaleable=no. - The CSS viewport width, as specified via the
widthproperty in the meta viewport tag, is not wider than the device width. In such cases, double-tap zoom is disallowed (precisely to avoid this delay) even thoug pinch-zooming is still allowed. Note that this happens in the common case where the property value iswidth=device-width. I believe this is the case Florens is referring to in comment 0 (with this check being a heuristic for detecting a "mobile-optimized site"). - The CSS
touch-actionproperty disallow double-tap zooming. Basically any value of this property other thanautohas this effect.
Comment 6•5 years ago
|
||
In Bug 1623941, we recently removed manual firing of mouse events after "touchstart" in RDM and replaced it with a better-supported platform API sendNativeTouchPoint. When there is a metaviewport and double-tap zoom is disallowed (according to Botond's criteria in Comment 5), the 300ms delay isn't present using Florens' test case. This fix became available in Firefox Nightly (78.0a1), so we can close this issue now.
Please feel free to re-open if anyone is still experiencing this issue.
Updated•5 years ago
|
| Reporter | ||
Comment 7•5 years ago
|
||
I'm getting good results with the attached test case:
0ms - touchstart
80ms - touchend
92ms - click
This is consistent with what Firefox Preview shows.
| Reporter | ||
Updated•5 years ago
|
Description
•