Skip to content

Commit

Permalink
Corrected shouldBeConsumedByChild logic for vertical scrolling; fixes m…
Browse files Browse the repository at this point in the history
  • Loading branch information
tibineagu committed Jul 12, 2022
1 parent c3354c0 commit 77471be
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/handlers/mouse-wheel.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,12 @@ export default function(i) {
if (deltaY && style.overflowY.match(/(scroll|auto)/)) {
const maxScrollTop = cursor.scrollHeight - cursor.clientHeight;
if (maxScrollTop > 0) {
// Note: negative deltaY means scrolling down
if (
(cursor.scrollTop > 0 && deltaY < 0) ||
(cursor.scrollTop < maxScrollTop && deltaY > 0)
// Already scrolled vertically, user is scrolling up
(cursor.scrollTop > 0 && deltaY > 0) ||
// Hasn't reached bottom, user is scrolling down
(cursor.scrollTop < maxScrollTop && deltaY < 0)
) {
return true;
}
Expand Down

0 comments on commit 77471be

Please sign in to comment.