-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ Load pages and ensure scrollbar is always visible #760
✨ Load pages and ensure scrollbar is always visible #760
Conversation
I'm just a bit curious about some more esoteric scenarios: you load a first page, it has a scrollbar, font too big you zoom out, no more scroll bar =D I think we can let it be since a refresh fixes it |
@ericlinagora I just updated it so it does try to ensure the scroll bar is in view when the window is re-sized; |
if (scrollTop > 0 && scrollTop + clientHeight >= scrollHeight) { | ||
await loadNextPage(parentId); | ||
} | ||
}; | ||
|
||
useEffect(() => { | ||
if(!loading) scrollViwer.current?.addEventListener('scroll', handleScroll, { passive: true }); | ||
if (!loading) | ||
scrollViewer.current?.addEventListener('scroll', handleScroll, { passive: true }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good to me, but have you considered replacing the scroll event with the Intersection Observer API in the future? I saw that the scroll event triggers even when the scrollbar hasn’t reached the target point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know about that API, looks great thanks
No description provided.