mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-06 10:20:09 +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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const scrollTop = currentPosition.scrollY;
|
||||||
|
|
||||||
|
// It needed for mostly to handle rubber band scrolling
|
||||||
|
if (scrollTop < navbarHeight.current) {
|
||||||
|
setIsNavbarVisible(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (isFocusedAnchor.current) {
|
if (isFocusedAnchor.current) {
|
||||||
isFocusedAnchor.current = false;
|
isFocusedAnchor.current = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const scrollTop = currentPosition.scrollY;
|
|
||||||
const lastScrollTop = lastPosition?.scrollY;
|
const lastScrollTop = lastPosition?.scrollY;
|
||||||
const documentHeight =
|
const documentHeight =
|
||||||
document.documentElement.scrollHeight - navbarHeight.current;
|
document.documentElement.scrollHeight - navbarHeight.current;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue