rafgraph / react-router-hash-link

Hash link scroll functionality for React Router
https://react-router-hash-link.rafgraph.dev
MIT License
732 stars 62 forks source link

Active style doesn't change when doing a normal scroll #71

Closed PiyushThePal closed 3 years ago

PiyushThePal commented 3 years ago

Active style doesn't change when doing a normal scroll from page to page it only changes when clicking on a particular link.

rafgraph commented 3 years ago

Active style matches the current url. The url changes when clicking on a link, but not when simply scrolling to an element. This is standard behavior of how element ids and links work in html. If you want the active style to change on normal scroll, you'll have to change the url using history.push(...) when the element is scrolled into view, which is out of scope of the library.