Repository navigation
Fix same-page anchor links being reset to top by Tito - #165
Merged
Merged
Conversation
The Tito widget script runs vue-router in the host page. It listens to popstate, which a native fragment navigation fires, and then calls window.scrollTo(0, 0). On the homepage, clicking "Tickets" in the menu (/#tickets) or the hero price link (#tickets) left Firefox at the top of the page. - nav.html: intercept left-clicks on same-page anchor links, scroll to the target with scrollIntoView and update the URL with pushState, which does not fire popstate - Close the mobile menu when such a link is clicked inside it - CLAUDE.md: tickets.html no longer loads the Tito script (it is in head.html on the homepage only since #164); document the workaround
✅ Deploy Preview for pycon-ireland-2026 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Problem
On the homepage, clicking Tickets in the main menu (
/#tickets) or the hero price link (#tickets) does not scroll to the tickets section in Firefox: the URL gets#ticketsbut the page stays at the top. Chromium usually wins the race thanks to smooth scrolling.Root cause: the Tito widget script (
js.tito.io) runs vue-router in the host page. It listens topopstate, which a native fragment navigation fires, then callshistory.replaceState(…)andwindow.scrollTo({top: 0})(traced tojs.tito.io/packs/js/9381-….js). With Tito blocked, the same click scrolls correctly.This was not introduced by #164: Tito was already loaded on the homepage before.
Fix
layouts/partials/nav.html: a click handler for same-page anchor links (plain left click, same origin/path, existing target, notargetattribute):scrollIntoView({behavior: 'smooth'}),history.pushState, which does not firepopstate, so Tito does not react,Modifier-clicks (new tab, etc.), cross-page links (e.g.
/#ticketsfrom/schedule/) and external links keep native behaviour.Also fixes a stale line in
CLAUDE.mdabout where the Tito script is loaded.Verification (Playwright, local build vs current production)
/schedule/→ menu "Tickets"The Tito widget still renders in every case.
Known limitation: the browser Back button fires
popstate, so Tito may still scroll to the top in that case.🤖 Generated with Claude Code