Skip to content

Commit ffad204

Browse files
authoredSep 13, 2023
fix: scrolling zero-dimension elements (#901)
Fixes #900
1 parent e5c08e7 commit ffad204

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -515,14 +515,14 @@ export const compute = (target: Element, options: Options): ScrollAction[] => {
515515

516516
const { scrollLeft, scrollTop } = frame
517517
// Ensure scroll coordinates are not out of bounds while applying scroll offsets
518-
blockScroll = Math.max(
518+
blockScroll = scaleY === 0 ? 0 : Math.max(
519519
0,
520520
Math.min(
521521
scrollTop + blockScroll / scaleY,
522522
frame.scrollHeight - height / scaleY + scrollbarHeight
523523
)
524524
)
525-
inlineScroll = Math.max(
525+
inlineScroll = scaleX === 0 ? 0 :Math.max(
526526
0,
527527
Math.min(
528528
scrollLeft + inlineScroll / scaleX,

0 commit comments

Comments
 (0)