mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-03 16:59:06 +02:00
fix: handle rubber band scrolling in hideable navbar (#5721)
This commit is contained in:
parent
d799405ace
commit
fd41239f4f
1 changed files with 8 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue