Skip to content

Commit

Permalink
fix(v2): various minor bugs with location hash (#4200)
Browse files Browse the repository at this point in the history
* fix(v2): various minor bugs with location hash

* Fix for disabled hideScroll
  • Loading branch information
lex111 authored Feb 9, 2021
1 parent c5d3a86 commit 74a58ef
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ function SkipToContent(): JSX.Element {
};

useEffect(() => {
programmaticFocus(containerRef.current);
if (!location.hash) {
programmaticFocus(containerRef.current);
}
}, [location.pathname]);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ const useHideableNavbar = (hideOnScroll: boolean): useHideableNavbarReturns => {
return;
}

if (!location.hash) {
return;
}

isFocusedAnchor.current = true;
}, [location.hash]);

Expand Down

0 comments on commit 74a58ef

Please sign in to comment.