Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork164
fix: improve underlining in "On this page"#1312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This ensures that the anchor that is clicked is always the one that getsunderlined, even if just scrolling to that heading would underline adifferent anchor.Using `onhashchange` alone instead of adding `onclick`s to each anchoris not sufficient because it's possible to click on an anchor thatalready has its hash in the URL but has been scrolled away from.
@zqianem is attempting to deploy a commit to theSvelte Team onVercel. A member of the Team first needs toauthorize it. |
vercelbot commentedApr 20, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
The latest updates on your projects. Learn more aboutVercel for Git ↗︎
|
Did some more testing on this and the results are actually browser-dependent based on the relative timings of the Even so, there is still a flash of underlining on the wrong anchor before the one clicked on is underlined, and the wrong anchor will always be underlined if loading the page from a link with an anchor (e.g.current vs.this PR). Either way, this PR unifies and fixes the behavior — the anchor link that is clicked is always the one underlined. |
This ensures that the anchor that is clicked is always the one that gets underlined, even if just scrolling to that heading would underline a different anchor.
A good test page for thishttps://svelte.dev/docs/kit/introduction; set the browser window size to 1200x1200 and try to click on "What is SvelteKit" in the right sidebar.
Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.