fix(pages): scroll docs deep links on load#413
Conversation
|
✅ OpenCodeReview: No comments generated. Looks good to me. |
|
Thanks for the fix — the core deep-link scrolling logic is correct and the retry/cancel handling is solid. A few things to address before merging: 1.
|
Read the routed fragment after markdown renders so direct links and later hash changes reach their headings. Retry briefly for rendered content and cancel stale attempts during navigation. The routed-fragment effect and the in-content link handler share a single scrollToFragmentWhenReady helper, so the rAF retry loop is defined once and the click path gains the cancellation it previously lacked. Co-Authored-By: Codex <codex@openai.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2e23264 to
714bb79
Compare
|
Thanks for the careful review. All three items are addressed in
The PR now changes only Verified:
|
Description
Direct docs links now scroll to their fragment after the rendered markdown heading is available. The effect reads React Router's location hash, decodes percent-encoded fragments, retries briefly while content renders, and cancels stale retries when navigation changes.
Since #407 switched the site to BrowserRouter, verification used the equivalent clean URLs under
/docs/....AI assistance: OpenAI Codex helped implement and verify this change. I reviewed the full diff and take responsibility for it.
Type of Change
How Has This Been Tested?
make testpasses locallymake checkcd pages && npm run typecheckcd pages && npm run buildScreenshots
Before, a directly loaded fragment remains at the top of the FAQ:
After, the same URL scrolls to the requested FAQ section:
Checklist
go fmt,go vet)Related Issues
Closes #412