Skip to content

Commit cd24189

Browse files
committed
fix: correct edge case behavior on non zero browser zoom levels
1 parent 55d302b commit cd24189

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/handleScroll.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,15 @@ export const handleScroll = (
113113
(targetInLock && (endTarget.contains(target) || endTarget === target))
114114
);
115115

116-
if (isDeltaPositive && ((noOverscroll && availableScroll === 0) || (!noOverscroll && delta > availableScroll))) {
116+
// handle epsilon around 0 (non standard zoom levels)
117+
if (
118+
isDeltaPositive &&
119+
((noOverscroll && Math.abs(availableScroll) < 1) || (!noOverscroll && delta > availableScroll))
120+
) {
117121
shouldCancelScroll = true;
118122
} else if (
119123
!isDeltaPositive &&
120-
((noOverscroll && availableScrollTop === 0) || (!noOverscroll && -delta > availableScrollTop))
124+
((noOverscroll && Math.abs(availableScrollTop) < 1) || (!noOverscroll && -delta > availableScrollTop))
121125
) {
122126
shouldCancelScroll = true;
123127
}

0 commit comments

Comments
 (0)