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

If Text Editor Component uses the scroll event, consume it / prevent bubbling #20347

Merged
merged 3 commits into from Apr 3, 2020

Conversation

robobenklein
Copy link
Contributor

@robobenklein robobenklein commented Jan 23, 2020

Identify the Bug

Scrolling a text editor component lets the mousewheel event bubble up and cause scrolling events even though the event has been acted upon / used.

In a normal browser the inner scrollable would scroll to the edge before then scrolling the parent. This change makes it consistent with expected HTML scroll behaviour.

Without it, the scroll event continues outside the editor to any other element containing it, even though the scroll event already was acted upon by the child (text editor component).

If a package wanted to also use the mouse wheel event when integrating into a text editor (or if the text editor itself is inside something scrollable) this change makes more sense as it prevents multiple responses to a single user input.

Description of the Change

Prevent the default action of the event if it is consumed.

Possible Drawbacks

There doesn't appear to be any side effects to this change. (Tested on linux: Pop_OS 19.10, 1.42.0)

I don't think a release note is needed, but "Text Editor consumes scroll wheel events when used" sounds accurate.

…bubbling

In a normal browser the inner scrollable would scroll to the edge before then scrolling the parent. This change makes it consistent with expected HTML scroll behaviour.

Without it, the scroll event continues outside the editor to any other element containing it, even though the scroll event already was acted upon by the child (text editor component).

If a package wanted to also use the mouse wheel event when integrating into a text editor (or if the text editor itself is inside something scrollable) this change makes more sense as it prevents multiple responses to a single user input.

There doesn't appear to be any side effects to this change. (Tested on linux: Pop_OS 19.10, 1.42.0)
robobenklein added a commit to CodeRibbon/CodeRibbon that referenced this issue Jan 24, 2020
@lkashef lkashef self-assigned this Apr 2, 2020
@lkashef
Copy link
Contributor

lkashef commented Apr 3, 2020

Thanks @robobenklein for the contribution 🙇‍♂️

@lkashef lkashef merged commit ef6cc4a into atom:master Apr 3, 2020
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants