Skip to content

Comments

Fix hash navigation logic#1505

Open
Grafikart wants to merge 1 commit intohotwired:mainfrom
Grafikart:fix/hash-navigation
Open

Fix hash navigation logic#1505
Grafikart wants to merge 1 commit intohotwired:mainfrom
Grafikart:fix/hash-navigation

Conversation

@Grafikart
Copy link

@Grafikart Grafikart commented Feb 16, 2026

Fix how turbo handle hash navigation.

Issue

On my website I have links looking like this

<li><a href="#t0">00:00</a> Intro</li>

Here is how "href" behaves for such links

link.href  // http://localhost/courses/temporibus-accusamus-ullam-sed-5#t0' so it will never start with #
link.getAttribute('href') // '#t0'

With the fix, the navigation is not tracked by turbo, but navigating back to a known hash triggers a popstate event. So turbo logic need to be fenced to not be triggered.

I needed this change since my page contains an autoplay and a hash change make the video played multiple time. Like this issues #1017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant