We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 26dce23 commit 4e4c08aCopy full SHA for 4e4c08a
.changeset/decode-hash-scroll.md
@@ -0,0 +1,5 @@
1
+---
2
+"react-router-dom": patch
3
4
+
5
+Properly decode element id when emulating hash scrolling via `<ScrollRestoration>`
contributors.yml
@@ -222,3 +222,4 @@
222
- yionr
223
- yuleicul
224
- zheng-chuang
225
+- istarkov
packages/react-router-dom/index.tsx
@@ -1384,7 +1384,9 @@ function useScrollRestoration({
1384
1385
// try to scroll to the hash
1386
if (location.hash) {
1387
- let el = document.getElementById(location.hash.slice(1));
+ let el = document.getElementById(
1388
+ decodeURIComponent(location.hash.slice(1))
1389
+ );
1390
if (el) {
1391
el.scrollIntoView();
1392
return;
0 commit comments