🐛 Prevent scroll-to-top on restart/fast buttons in termynal.js#1888
Closed
cesar32az wants to merge 1 commit into
Closed
🐛 Prevent scroll-to-top on restart/fast buttons in termynal.js#1888cesar32az wants to merge 1 commit into
termynal.js#1888cesar32az wants to merge 1 commit into
Conversation
Port of fastapi/fastapi#13714: the `restart ↻` and `fast →` controls are anchors with `href='#'`, so clicking them can navigate to `#` and jump the page to the top. Use `javascript:void(0)` instead, matching the fix already live on the FastAPI docs. Claude-Session: https://claude.ai/code/session_01HJ8JfXbXGXcAk2jEh2dZVg
Contributor
📝 Docs previewLast commit 2fbe5bb at: https://e665272d.typertiangolo.pages.dev Modified Pages |
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.
Description
Fixes the intermittent scroll-to-top when clicking the
restart ↻/fast →controls on the animated terminal blocks in the docs, reported today in discussion #1887 (credit to the reporter for the find and the FastAPI-vs-Typer comparison).Root cause: both controls are anchors with
href='#'. Although the click handlers calle.preventDefault(), navigation to#can still slip through (e.g. whenrestartwipescontainer.innerHTMLmid-event), jumping the page to the top — which matches the "sometimes happens, sometimes doesn't" behavior described in the report.This is a 1:1 port of the fix already merged and live on the FastAPI docs: fastapi/fastapi#13714 — the same two lines in the same vendored
termynal.js, usingjavascript:void(0)so the anchor never navigates.Verification
docs/js/termynal.jswas otherwise already in sync with FastAPI's copy except for these two lines (and one blank line).Related discussion: #1887