Skip to content

Commit 4fb387d

Browse files
committed
fix: emit prevented hashchange event
1 parent f079a22 commit 4fb387d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/client/app/router.ts

+2
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ export function createRouter(
133133
// scroll between hash anchors in the same page
134134
if (hash && hash !== currentUrl.hash) {
135135
history.pushState(null, '', hash)
136+
// still emit the event so we can listen to it in themes
137+
window.dispatchEvent(new Event('hashchange'))
136138
// use smooth scroll when clicking on header anchor links
137139
scrollTo(link, hash, link.classList.contains('header-anchor'))
138140
}

0 commit comments

Comments
 (0)