Fix anchors not working (#20255)

This commit is contained in:
ktmouk 2023-10-20 04:32:52 +09:00 committed by GitHub
parent 3b37658df5
commit 2314043432
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -170,6 +170,15 @@ if (document.location.pathname === '/admin/creator_settings/new') {
}
document.ready.then(() => {
// Our infinite scroll pattern causes problems with the browser's back button:
// specifically, if you've scrolled into page 2+, click into a post, then back
// to the feed, the browser scroll position will not be where you had previously
// scrolled. This seems to fix it, even though it seems like it should have
// the opposite effect.
setTimeout(() => {
history.scrollRestoration = 'manual';
}, 0);
const hamburgerTrigger = document.getElementsByClassName(
'js-hamburger-trigger',
)[0];
@ -179,10 +188,3 @@ document.ready.then(() => {
trackCreateAccountClicks('authentication-hamburger-actions');
trackCreateAccountClicks('authentication-top-nav-actions');
trackCreateAccountClicks('comments-locked-cta');
// Our infinite scroll pattern causes problems with the browser's back button:
// specifically, if you've scrolled into page 2+, click into a post, then back
// to the feed, the browser scroll position will not be where you had previously
// scrolled. This seems to fix it, even though it seems like it should have
// the opposite effect.
history.scrollRestoration = 'manual';