Files
pbakaus_impeccable/public/js/utils
Paul Bakaus 7e473e48d0 fix(site): instant hash restore, retry on fonts.ready + load, drop smooth-scroll
Three related site scroll bugs:

1. initAnchorScroll and initHashTracking both called scrollTo with
   `behavior: 'auto'`, which defers to CSS `scroll-behavior`. Because
   sub-pages.css set `html { scroll-behavior: smooth }`, every anchor
   jump and reload-hash-restore animated — despite a code comment
   explicitly stating "Instant anchor scroll — no smooth scrolling".
   Switch to `behavior: 'instant'` so the JS wins.

2. The reload-hash restore used a fixed `setTimeout(100)` to compute
   target position. At 100ms, async Google Fonts (Cormorant Garamond
   italic) has not swapped in, so `getBoundingClientRect().top` is
   computed against fallback metrics and mislanded by hundreds of
   pixels. Retry on `document.fonts.ready` and on window `load`.

3. Remove `scroll-behavior: smooth` from sub-pages.css entirely —
   it was silently fighting the JS and made long-page anchor clicks
   feel sluggish.
2026-04-22 10:57:24 -07:00
..