Adjusted hash routing
This commit is contained in:
parent
de6f009905
commit
7c7c83bc43
1 changed files with 1 additions and 1 deletions
|
@ -12,11 +12,11 @@ export function useScrollToLocation() {
|
|||
hashRef.current = hash;
|
||||
scrolledRef.current = false;
|
||||
}
|
||||
navigate();
|
||||
if (scrolledRef.current) return;
|
||||
const id = hash.replace("#", "");
|
||||
const element = document.getElementById(id);
|
||||
if (!element) return;
|
||||
navigate();
|
||||
element.scrollIntoView({ behavior: "smooth", block: "start" });
|
||||
scrolledRef.current = true;
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue