fix: handle rubber band scrolling in hideable navbar (#5721)

This commit is contained in:
Alexey Pyltsyn 2021-10-20 18:43:10 +03:00 committed by GitHub
parent d799405ace
commit fd41239f4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,12 +24,19 @@ const useHideableNavbar = (hideOnScroll: boolean): useHideableNavbarReturns => {
return;
}
const scrollTop = currentPosition.scrollY;
// It needed for mostly to handle rubber band scrolling
if (scrollTop < navbarHeight.current) {
setIsNavbarVisible(true);
return;
}
if (isFocusedAnchor.current) {
isFocusedAnchor.current = false;
return;
}
const scrollTop = currentPosition.scrollY;
const lastScrollTop = lastPosition?.scrollY;
const documentHeight =
document.documentElement.scrollHeight - navbarHeight.current;