Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Only scroll one axis at a time, whichever has the greater delta #15324

Merged
merged 1 commit into from
Aug 16, 2017

Conversation

nathansobo
Copy link
Contributor

Fixes #15239

This PR fixes a logic error in the following line of code:

const scrollPositionChanged =
  this.setScrollLeft(this.getScrollLeft() + deltaX) ||
  this.setScrollTop(this.getScrollTop() + deltaY)

I didn't account for the "short-circuit" behavior of the or statement. With this code, we first attempt to scroll horizontally by deltaX, and if we scroll even a little, then we never attempt to scroll vertically. When I tested this originally, I thought we were getting the "one axis at a time" behavior automatically somehow, but really I was just seeing this bug. 🙈

This PR restores the behavior prior to 1.19 of scrolling only on one axis at a time, whichever has the greater delta.

@nathansobo nathansobo merged commit e9a00ce into master Aug 16, 2017
@nathansobo
Copy link
Contributor Author

/cc @as-cii

as-cii pushed a commit that referenced this pull request Aug 16, 2017
Only scroll one axis at a time, whichever has the greater delta
as-cii pushed a commit that referenced this pull request Aug 16, 2017
Only scroll one axis at a time, whichever has the greater delta
@jasonrudolph jasonrudolph deleted the ns-fix-mousewheel-handling branch October 28, 2017 00:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Horizontal scrolling is always favored over vertical scrolling
1 participant