Skip to content

Commit 2426f61

Browse files
committed
fix hideable navbar bug
1 parent b88126a commit 2426f61

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/docusaurus-theme-common/src/hooks/useHideableNavbar.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@ export function useHideableNavbar(hideOnScroll: boolean): {
6262
return;
6363
}
6464

65-
if (locationChangeEvent.location.hash) {
65+
// See https://github.com/facebook/docusaurus/pull/8059#issuecomment-1239639480
66+
const currentHash = locationChangeEvent.location.hash;
67+
const currentHashAnchor = currentHash
68+
? document.getElementById(currentHash.substring(1))
69+
: undefined;
70+
71+
if (currentHashAnchor) {
6672
isFocusedAnchor.current = true;
6773
setIsNavbarVisible(false);
6874
return;

0 commit comments

Comments
 (0)