Skip to content

Commit d5ad60a

Browse files
authored
Default scroll direction Down
There is an edge case where if your step element is visible when `scrollTop` is 0, the scroll `direction` will be `up`. I.e. when you first load your page, the first scroll direction you'll see in `onStepEnter` will be `up`. While admittedly an edge case, I think we should switch the logic so that the default scroll direction is `down`
1 parent 319f10b commit d5ad60a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Step.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const Step = props => {
2929

3030
const isBrowser = typeof window !== "undefined";
3131
const scrollTop = isBrowser ? document.documentElement.scrollTop : 0;
32-
const direction = lastScrollTop < scrollTop ? 'down' : 'up';
32+
const direction = lastScrollTop > scrollTop ? 'up' : 'down';
3333

3434
const rootMargin = useRootMargin(offset);
3535

0 commit comments

Comments
 (0)