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:
Alexey Pyltsyn 2021-02-09 17:25:33 +03:00 committed by GitHub
parent c5d3a86489
commit 74a58efe16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 2 deletions

View file

@ -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">

View file

@ -33,7 +33,9 @@ function SkipToContent(): JSX.Element {
};
useEffect(() => {
programmaticFocus(containerRef.current);
if (!location.hash) {
programmaticFocus(containerRef.current);
}
}, [location.pathname]);
return (

View file

@ -75,6 +75,10 @@ const useHideableNavbar = (hideOnScroll: boolean): useHideableNavbarReturns => {
return;
}
if (!location.hash) {
return;
}
isFocusedAnchor.current = true;
}, [location.hash]);