scrolling by touchmove not prevented through preventDefault nor stopPropagation
Categories
(Core :: DOM: UI Events & Focus Handling, defect, P2)
Tracking
()
People
(Reporter: bugzilla, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0
Steps to reproduce:
Firefox 73.0.1 (64 bit) on Windows (also observed on Android)
Trying to capture touchmove events while preventing default scrolling:
https://jsfiddle.net/892zq1jo
Actual results:
Firefox seems to scroll regardless of preventDefault(); when the touch is held a little while before touchmove.
Expected results:
Scrolling should have been prevented by preventDefault().
Comment 1•5 years ago
•
|
||
I can confirm that swiping after a touch hold (which triggers a standard Windows square visual cue to open context menu) scrolls the element.
Comment 2•5 years ago
|
||
Can confirm the same bug on Edge 18 but not on Chrome.
I think this is related to "select-by-touch-hold" (not sure about the terminology) that triggers some time (which?) after a "touch" without move.
When I style the target (canvas) with
-webkit-touch-callout:none;
-webkit-user-select:none;
-khtml-user-select:none;
-moz-user-select:none;
-ms-user-select:none;
user-select:none;
https://developer.mozilla.org/en-US/docs/Web/CSS/user-select
(taken from https://stackoverflow.com/a/11237968), the situation improves, especially for Chrome (on Android, on Windows tablet, on Windows in touch device emulation), which then does not select anything (nor does it show the context menu on "touchend").
Firefox on a Windows tablet with these styles applied to my canvas target still seems to have a timing issue:
- "short tap-drag": scrolling as expected
- "hold-drag" as intended by my application (something above 500 ms) seems to work without scrolling when the initial touch is held below a certain time
- "long-hold drag" causes scrolling
- "long-hold" causes context menu
Firefox on Android also does not exhibit scrolling on "touch-drag" when using these styles; it also does not show context menu on "long-touch".
I cannot test properly on Linux/Ubuntu, since my tablet's touchscreen gets emulated as mouse and does not emit any touchevents (tested with Firefox 73.0.1).
Could it be related to the "select" mode entered on "long touch", as for text this also requires scrolling to extend the text selection?
I will try to later find time to improve the "test case" to include timing output for selection
, scroll
and contextmenu
events as well.
Updated•3 years ago
|
Description
•