neurocracy / drupal-omnipedia-site-theme

The Drupal theme for Omnipedia.
GNU General Public License v2.0
0 stars 0 forks source link

Something is preventing Chrome scrolling to in-page anchors on page load #11

Open Ambient-Impact opened 1 year ago

Ambient-Impact commented 1 year ago

This can be seen in Chrome on https://omnipedia.app/wiki/2049/10/01/Xu_Shaoyong#Death - loading the page in a fresh tab or from another page is the most reliable way to replicate this.

A potential culprit is the scroll_blocker component which is used by several things, including the the overlay component, eu_cookie_compliance.overlay.js (though this might not be the root cause). However, after some tinkering in dev tools, the scrollbar_gutter component seems like it could be the cause, which is tangentially related to the scroll_blocker component. Interestingly, commenting out setting the custom property in its private setProperty() function seems to fix the scroll issue, so what could be happening is that Chrome is detecting a change in the scrollable viewport area and that's somehow triggering a heuristic that it uses to decide whether to scroll.

Upon further investigation, this issue also seems to manifest if you click on one of the table of contents links and happen to have your pointer trigger one of the attached data pop-ups as Chrome is smooth scrolling to the in-page anchor, which aborts the scroll for some baffling reason. Setting scroll-behavior: auto on the <html> element fixes all of it, but that's not ideal.

See the linked branch associated with this issue.

Links

It looks like this may be a known issue with Chrome: