Bug 163207 - touchmove event can't be default prevented
Summary: touchmove event can't be default prevented
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: UI Events (show other bugs)
Version: Safari 10
Hardware: iPhone / iPad iOS 10
: P2 Major
Assignee: Nobody
URL: http://codepen.io/anon/pen/PGRxOv
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-10-10 06:23 PDT by vpusher
Modified: 2017-03-29 07:33 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vpusher 2016-10-10 06:23:37 PDT
On Safari 10, by defining a simple listener that prevents default a 'touchmove' event within a scrollable element, the event is not prevent defaulted as it does with Safari 9.

The behavior between Safari 9 and Safari 10 diverges. It seems to be a regression.

This is reproducible here:  http://codepen.io/anon/pen/PGRxOv

Probably a webkit issue.

Steps to Reproduce:
1. Take an element with scrollable content (overflow: scroll).
2. Add an event listener on it for "touchmouve" event, and call `event.preventDefault()` in that event listener.

Expected Results:
The element should not be scrollable. To try to scroll on the related element should do nothing at all.

Actual Results:
The element is still scrollable on Safari 10.

Version:
iOS 10.0.2
Comment 1 Simon Fraser (smfr) 2016-10-13 11:38:39 PDT
I think this is <rdar://problem/28479522>
Comment 2 Chris Dumez 2016-10-13 11:54:24 PDT
This is <rdar://problem/28693432>.
Comment 3 Chris Dumez 2016-10-13 11:55:46 PDT
(In reply to comment #2)
> This is <rdar://problem/28693432>.

I investigated it yesterday and believe I found a workaround that Web authors can adopt until we fix this:
http://codepen.io/anon/pen/QKxpPg

You basically need to listen for the "touchforcechange" event and call preventDefault() on this one as well.
Comment 4 Chris Dumez 2016-10-13 11:58:03 PDT
(In reply to comment #3)
> (In reply to comment #2)
> > This is <rdar://problem/28693432>.
> 
> I investigated it yesterday and believe I found a workaround that Web
> authors can adopt until we fix this:
> http://codepen.io/anon/pen/QKxpPg
> 
> You basically need to listen for the "touchforcechange" event and call
> preventDefault() on this one as well.

I think the fix is likely to return false early in ScrollAnimatorIOS::handleTouchEvent() if the touch event is a TouchForceChange but I am not an expert in the area.
Comment 5 vpusher 2017-03-29 06:45:56 PDT
Fixed in 10.3. Thank you.
Comment 6 Simon Fraser (smfr) 2017-03-29 07:33:40 PDT
This was fixed in internal code, and a test added in https://trac.webkit.org/changeset/210516/.