mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-03 16:59:06 +02:00
fix(v2): various minor bugs with location hash (#4200)
* fix(v2): various minor bugs with location hash * Fix for disabled hideScroll
This commit is contained in:
parent
c5d3a86489
commit
74a58efe16
3 changed files with 8 additions and 2 deletions
|
@ -83,7 +83,7 @@ function Navbar(): JSX.Element {
|
|||
'navbar--primary': style === 'primary',
|
||||
'navbar-sidebar--show': sidebarShown,
|
||||
[styles.navbarHideable]: hideOnScroll,
|
||||
[styles.navbarHidden]: !isNavbarVisible,
|
||||
[styles.navbarHidden]: hideOnScroll && !isNavbarVisible,
|
||||
})}>
|
||||
<div className="navbar__inner">
|
||||
<div className="navbar__items">
|
||||
|
|
|
@ -33,7 +33,9 @@ function SkipToContent(): JSX.Element {
|
|||
};
|
||||
|
||||
useEffect(() => {
|
||||
programmaticFocus(containerRef.current);
|
||||
if (!location.hash) {
|
||||
programmaticFocus(containerRef.current);
|
||||
}
|
||||
}, [location.pathname]);
|
||||
|
||||
return (
|
||||
|
|
|
@ -75,6 +75,10 @@ const useHideableNavbar = (hideOnScroll: boolean): useHideableNavbarReturns => {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!location.hash) {
|
||||
return;
|
||||
}
|
||||
|
||||
isFocusedAnchor.current = true;
|
||||
}, [location.hash]);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue