mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
If Text Editor Component uses the scroll event, consume it / prevent 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)
This commit is contained in:
@@ -1736,7 +1736,10 @@ module.exports = class TextEditorComponent {
|
||||
const scrollTopChanged =
|
||||
wheelDeltaY !== 0 && this.setScrollTop(this.getScrollTop() - wheelDeltaY);
|
||||
|
||||
if (scrollLeftChanged || scrollTopChanged) this.updateSync();
|
||||
if (scrollLeftChanged || scrollTopChanged) {
|
||||
event.preventDefault();
|
||||
this.updateSync();
|
||||
}
|
||||
}
|
||||
|
||||
didResize() {
|
||||
|
||||
Reference in New Issue
Block a user