New issue
Advanced search Search tips

Issue 889846 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: 2018-10-18
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

mousewheelEvent.preventDefault() is not working consistently

Reported by jessedes...@gmail.com, Sep 27

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36

Steps to reproduce the problem:
1. Use Chrome for a while
2. Try to scroll to the left 
3. The navigation gesture is triggered, even though event.preventDefault() is called

https://stackoverflow.com/questions/44899193/cant-prevent-navigation-gesture-in-latest-chrome-version-59-on-mac

What is the expected behavior?
The navigation gesture should not be triggered if event.preventDefault() is called.

What went wrong?
I described the issue in more detail here: https://stackoverflow.com/questions/44899193/cant-prevent-navigation-gesture-in-latest-chrome-version-59-on-mac

Did this work before? N/A 

Chrome version: 69.0.3497.100  Channel: stable
OS Version: OS X 10.13.4
Flash Version: 

After restarting Chrome it works temporarily but the issue keeps coming back. Airtable users also reported this:
https://community.airtable.com/t/triggering-back-gesture-in-chrome-on-macos-when-scrolling-to-the-left/3074/12
 
Labels: Needs-Triage-M69
Components: -Blink Blink>Input
Cc: sahel@chromium.org
Labels: Needs-Feedback
NextAction: 2018-10-18
Hi jessedesaever@, Thank you for your report.

This is expected behavior on Chrome.

If you are developer, please try to use overscroll-behavior to fix it. https://developer.mozilla.org/en-US/docs/Web/CSS/overscroll-behavior

If you are user, please try to disable overscroll swipe on MacOS settings. See thread you provide. https://community.airtable.com/t/triggering-back-gesture-in-chrome-on-macos-when-scrolling-to-the-left/3074/6

For event.preventDefault() is not cancellable every wheel event. https://github.com/w3c/uievents/pull/171/commits/824a919756b4c5702a9878efd45ea5c93a2d73a3

Let me know if you still having question.
Chrome has enabled async wheel event handling starting from M65:
It means that if the first wheel event in a scroll sequence is not cancelled, then the rest of the wheel events in the sequence are not cancel-able. This behavior is consistent with async touch event handling.
Hi chaopeng and sahel,

Thanks a lot for your responses. I will try using overscroll-behavior once the issue occurs again. 

I'm not really convinced this is expected behavior though. For example, right now I am not able to reproduce the issue. But after using Chrome for a while it always comes back and then even preventing the first mousewheel event doesn't work. Only restarting Chrome helps. That sounds like an inconsistent behavior to me. What do you think?

Thanks,
Jesse
Project Member

Comment 6 by sheriffbot@chromium.org, Oct 5

Cc: chaopeng@chromium.org
Labels: -Needs-Feedback
Thank you for providing more feedback. Adding the requester to the cc list.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: Needs-Feedback
Status: Closed (was: Unconfirmed)
Chao did you need any other feedback from the reporter? I'm going to close this for now as this was the intended behavior.
The inconsistent behavior seems because user start scroll from different element on page based on the test pages on link should be intended.
The NextAction date has arrived: 2018-10-18
Hi Chrome Team,

I just encountered this behavior again (Chrome 69.0.3497.100) and recorded a screencast in which I tried using overscroll-behavior and also added another listener to the mousewheel event to preventDefault. But the only way I can stop this behavior is by restarting Chrome. https://we.tl/t-0Thcz1ekgn

Hope this helps,
Jesse

Cc: sunyunjia@chromium.org
Owner: majidvp@chromium.org
Status: Assigned (was: Closed)
Here is my example http://ht.chaopeng.me/wheel-block.html

I still do not how to reproduce the preventDefault issue. But this example shows the issue using overscroll-behavior on element. I don't know what is the different between this example with https://mdn.github.io/css-examples/overscroll-behavior/.

jessedesaever@ please try using overscroll-behavior on body see if it resolve your issue.
Cc: majidvp@chromium.org
Owner: sahel@chromium.org
jessedesaever@ Thanks for the video.

Chrome has this intervention that document level touch event listeners (those registered on window, body, or document) are passive by default unless if the developer adds the passive:false option. other browsers like Safari and Firefox have adopted this intervention later on.

For wheel scrolling we are working on adding the same intervention. We have the feature behind a flag which is enabled via finch trial.
Please try one/both of the following two:
1- In your example add passive:false to the event listener that prevents default.
2- from chrome flags disable "Document Level Wheel Event Listeners Passive Default"

And see if this resolves the issue.

The reason for this change is performance improvement since our statistics show
that:
75% of the wheel event listeners added to a document level element do not specify passive option, and more than 98% of such listeners do not call preventDefault.

create another issue tracking the overscroll-behavior issue https://bugs.chromium.org/p/chromium/issues/detail?id=897267
Thanks for your responses and suggestions @majidvp & @sahel.
Next time the issue occurs I will try to
* use overscroll-behavior on the body
* mark the mousewheel listener as active / not passive
* disable the flag 

It's weird that this issue only occurs from time to time though... I would expect it to be reproducable if the lack of the {passive: false} parameter was the cause of the issue.

Thanks,
Jesse
It occurred again today. 
* overscroll-behavior: contain; on the body didn't help
* window.addEventListener('mousewheel', e => e.preventDefault(), {passive: false}) didn't help
* Disabling the flag requires a restart. Restarting Chrome fixes the issue anyway though, so I can't tell if it helped.
Please try overscroll-behavior: none.

I don't thank verscroll-behavior: contain; on the body actually works. please report https://bugs.chromium.org/p/chromium/issues/detail?id=897267
Thanks for your response! 

I couldn't test your suggestion in the buggy scenario yet because it didn't occur again. 

But I can say that overscroll-behavior: none on the body seems to deactivate the gesture reliably for the whole page. That's not really what I want but it's a workaround. Ideally, preventDefault on mousewheel events should always work as expected. I'm sorry I can't give you any details about how to reproduce the buggy state in Chrome, it only occurs about once a week.

Thanks for looking into this and for providing suggestions :-)
The problem occurred again today and I tried to use overscroll-behavior: none on the body. Surprisingly, it doesn't work. I recorded the behavior: 
https://we.tl/t-vdUD65aciu

So to recap, preventing the default behavior of mousewheel events or setting the overscroll-behavior of the body to none usually work for me. But from time to time, Chrome gets into a state where none of those work until I restart the browser.

Thanks,
Jesse

Sign in to add a comment