Skip to content

Commit

Permalink
Fix elementId from hash
Browse files Browse the repository at this point in the history
  • Loading branch information
istarkov committed Jun 26, 2023
1 parent fff84b5 commit ff9bd8b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/react-router-dom/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1354,7 +1354,9 @@ function useScrollRestoration({

// try to scroll to the hash
if (location.hash) {
let el = document.getElementById(location.hash.slice(1));
let el = document.getElementById(
decodeURIComponent(location.hash.slice(1))
);
if (el) {
el.scrollIntoView();
return;
Expand Down

0 comments on commit ff9bd8b

Please sign in to comment.