Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web: Do not scroll the page when mouse wheel is handled in AVM2 #19029

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

kjarosh
Copy link
Member

@kjarosh kjarosh commented Dec 20, 2024

This patch prevents scrolling the page when the users scrolls content inside the SWF (i.e. when the content somehow handles the scroll).

Based on my testing this behavior is a lot smarter than Flash originally had, because Flash just trapped mouse wheel events. We might want to add an option to simulate this behavior too in the future.

You can easily test the behavior here: https://www.newgrounds.com/portal/view/922049.

@kjarosh kjarosh added A-web Area: Web & Extensions input Issues relating to user input in Flash content T-compat Type: Compatibility with Flash Player labels Dec 20, 2024
Useful on Chromium-based browsers, where the modal
is always displayed at the beginning.
This patch prevents scrolling the page when the users scrolls content
inside the SWF (i.e. when the content somehow handles the scroll).
This test verifies how scrolling works in AVM2 and whether
the page is scrolled when it should be or not.
@Dinnerbone
Copy link
Contributor

Dinnerbone commented Dec 27, 2024

Oh no this is going to bring up the "where's the line" debate again :D

This does not match Flash's behaviour, AS3 mouse wheel events explicitly do not prevent the page from scrolling. It was a known trick to use AVM1 for scroll wheel stuff, which did prevent scrolling.

The linked page in original Flash does not prevent scrolling.

basilisk_6fNf97b3K3.mp4

@kjarosh
Copy link
Member Author

kjarosh commented Dec 27, 2024

So... I tested this a bit more, and I originally did tests with default params and assumed the result is always the same. Turns out the mouse wheel is trapped only when wmode is window, opaque, or transparent (not on direct, gpu). It's direct on NG, and it was window in my tests.

@torokati44
Copy link
Member

Is this FP behavior consistent across browsers and platforms? 🤔

@kjarosh
Copy link
Member Author

kjarosh commented Dec 28, 2024

Is this FP behavior consistent across browsers and platforms? 🤔

Turns out this behavior differed across browsers and varied in time. We had a discussion about it on Discord, and I guess the bottom line was not to follow Flash Player in this regard.

Pasting some links from @n0samu:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-web Area: Web & Extensions input Issues relating to user input in Flash content T-compat Type: Compatibility with Flash Player
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants