Skip to content

Fix repeated clicks to the same fragment

username-removed-443319 requested to merge fix-repeated-header-scrolling into master

Because of the fixed header, there's a listener on the hashchange event to scroll the browser to the correct point.

However, this event only fires when the fragment changes, so if you are already at a particular fragment, scroll around, and click another link to the same fragment, the event won't fire and the part of the page you're going to will be hidden behind the header.

The popstate event is always fired when a link to a fragment identifier is clicked, even if it's the same as the one currently shown in the location field. This needs a small delay in the same way as the load handler, so consolidate the two identical functions. For IE < 10, continue to use the hashchange event.

Before: Before

After: After

Merge request reports

Loading