Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix smooth-scroll to not break the back button
In the Beginning, "Community" in the navbar on the homepage was a normal link, and clicking it would take you to the Community section and highlight the heading, and the browser Back button would take you back to your scroll position at the top of the page where the navbar was. Then I added smooth-scrolling so that when you click "Community" in the navbar it would smoothly scroll down to the Community heading, and highlight it. Problem: if you then hit the browser Back button, the heading highlight would vanish but you would stay in place, rather than the expected behavior of going back to the scroll position at the top of the page where you clicked on the navbar. Now I'm finally fixing that by doing history.pushState(): https://developer.mozilla.org/en-US/docs/Web/API/History_API (falling back to the old technique if unavailable) Of course the web platform sucks so we have to contend with: whatwg/html#639
- Loading branch information
8d89f89
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should also credit http://stackoverflow.com/a/14690177/362030