mauricevancooten / react-anchor-link-smooth-scroll

React component for anchor links using the smooth scroll polyfill.
243 stars 31 forks source link

Need ability to add navigation to history #12

Closed TroyWolf closed 5 years ago

TroyWolf commented 6 years ago

Not a "bug", but did not know how else to ask for this feature. Want to be able to have the anchor navigation be part of browser history so back button return to where the user was before scrolling to the anchor. I note this package offers this as an option: https://github.com/gabergg/react-scrollable-anchor

However, the scrolling in that project was terrible in my testing. This project has beautiful, smooth scrolling.

mauricevancooten commented 6 years ago

@gazpachu added the possibility for the hash to change in the address bar but I'm not sure how he implemented that in practice. https://github.com/mauricevancooten/react-anchor-link-smooth-scroll/issues/5 this is his pull request, https://github.com/mauricevancooten/react-anchor-link-smooth-scroll/pull/6

airandfingers commented 5 years ago

6 didn't add that functionality, just fixed a bug with onClick.

https://stackoverflow.com/questions/3870057/how-can-i-update-window-location-hash-without-jumping-the-document shows a way to do this.

I'll submit a PR to implement this in the near future.