Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,14 @@ export const QwikCityProvider = component$<QwikCityProps>((props) => {
if (isBrowser) {
// Use `location.href` because the lastDest signal is only updated on page navigates.
if (type === 'link' && dest.href !== location.href) {
history.pushState(null, '', dest);
if (location.href.startsWith(dest.href.split('#')[0])) {
location.hash = dest.hash;
if (location.hash === '') {
history.pushState(null, '', dest);
}
} else {
history.pushState(null, '', dest);
}
}

// Always scroll on same-page popstates, #hash clicks, or links.
Expand Down
Loading