mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-30 15:00:09 +02:00
fix(theme): preserve url ?search#hash on navbar version/locale dropdowns navigations (#8059)
This commit is contained in:
parent
67c692326b
commit
a492025cbf
3 changed files with 16 additions and 3 deletions
|
@ -62,7 +62,13 @@ export function useHideableNavbar(hideOnScroll: boolean): {
|
|||
return;
|
||||
}
|
||||
|
||||
if (locationChangeEvent.location.hash) {
|
||||
// See https://github.com/facebook/docusaurus/pull/8059#issuecomment-1239639480
|
||||
const currentHash = locationChangeEvent.location.hash;
|
||||
const currentHashAnchor = currentHash
|
||||
? document.getElementById(currentHash.substring(1))
|
||||
: undefined;
|
||||
|
||||
if (currentHashAnchor) {
|
||||
isFocusedAnchor.current = true;
|
||||
setIsNavbarVisible(false);
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue