fix(docs-site): toc scroll jumpiness, stale og caches, mobile language picker - #91
Merged
Conversation
…ile language select - TOC: same-document hash changes fired the popstate SPA handler, which refetched the page and swapped .main mid-scroll — clicks felt broken and jumpy. Guard popstate with a document key so hash-only moves skip the refetch; hold the scrollspy for 900ms after a click (it was calling scrollIntoView every scroll frame, cancelling the smooth scroll) and scroll the toc list manually instead. - og: cards are served immutable for a year, so the redesign never reached cached edges/browsers. Version og:image/twitter:image URLs with a content hash of the og template (router ignores query strings for R2 lookup, same pattern as assetUrl). - Language picker: overlay an invisible native <select> on the trigger at coarse-pointer widths so mobile gets the platform picker instead of the custom dropdown. - Smoke: contracts for all three.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-ups to #89/#90 from design review:
popstate(same-document hash navigation), and the SPA handler refetched the page and swapped.mainmid-scroll; the scrollspy also calledscrollIntoViewon every scroll frame, cancelling the in-flight smooth scroll. Now: popstate skips the refetch when only the hash changed, the clicked link activates immediately, the spy holds for 900ms, and the toc list scrolls viascrollTopinstead ofscrollIntoView. Verified with Playwright: zero refetches on toc clicks, heading lands exactly at scroll-padding, active state stable, back-button intact.max-age=31536000, immutable, so CDN edges and browsers keep pre-redesign cards indefinitely. og/twitter image URLs now carry?v=<hash of og template+svg>(the Worker router keys R2 lookups on pathname, same asassetUrl), busting every cache layer and future-proofing template changes.<select>overlays the trigger at ≤820px, so phones get the platform picker; desktop keeps the custom menu. Verified: 21 options, selecting a locale navigates to the localized page.Smoke contracts added for all three.