mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-06 10:20:09 +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--primary': style === 'primary',
|
||||||
'navbar-sidebar--show': sidebarShown,
|
'navbar-sidebar--show': sidebarShown,
|
||||||
[styles.navbarHideable]: hideOnScroll,
|
[styles.navbarHideable]: hideOnScroll,
|
||||||
[styles.navbarHidden]: !isNavbarVisible,
|
[styles.navbarHidden]: hideOnScroll && !isNavbarVisible,
|
||||||
})}>
|
})}>
|
||||||
<div className="navbar__inner">
|
<div className="navbar__inner">
|
||||||
<div className="navbar__items">
|
<div className="navbar__items">
|
||||||
|
|
|
@ -33,7 +33,9 @@ function SkipToContent(): JSX.Element {
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (!location.hash) {
|
||||||
programmaticFocus(containerRef.current);
|
programmaticFocus(containerRef.current);
|
||||||
|
}
|
||||||
}, [location.pathname]);
|
}, [location.pathname]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -75,6 +75,10 @@ const useHideableNavbar = (hideOnScroll: boolean): useHideableNavbarReturns => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!location.hash) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
isFocusedAnchor.current = true;
|
isFocusedAnchor.current = true;
|
||||||
}, [location.hash]);
|
}, [location.hash]);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue