Skip to content

Commit 175120a

Browse files
committed
✨ NEW: update hash in url according to element in view
1 parent ee1669b commit 175120a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

demo-app/src/components/ScrollSpy/ScrollSpy.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ const ScrollSpy = ({
6969
// and see if its ID matches the ID we got from the viewport
7070
if (attrId === changeHighlightedItemId) {
7171
el.classList.add("active-scroll-spy");
72+
window.history.pushState({}, "", `#${changeHighlightedItemId}`);
7273
}
7374
});
7475
}

0 commit comments

Comments
 (0)