We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5395ddf commit cd3804cCopy full SHA for cd3804c
packages/qwik-city/src/runtime/src/qwik-city-component.tsx
@@ -253,7 +253,12 @@ export const QwikCityProvider = component$<QwikCityProps>((props) => {
253
if (isBrowser) {
254
// Use `location.href` because the lastDest signal is only updated on page navigates.
255
if (type === 'link' && dest.href !== location.href) {
256
- history.pushState(null, '', dest);
+ const withoutHash = dest.href.split('#')[0];
257
+ if (location.href.startsWith(withoutHash + '#')) {
258
+ location.hash = dest.hash;
259
+ } else {
260
+ history.pushState(null, '', dest);
261
+ }
262
}
263
264
// Always scroll on same-page popstates, #hash clicks, or links.
0 commit comments