fix: decode when query selecting current hash

close #2089
pull/2104/head
Evan You 1 year ago
parent a9e07ce144
commit 1f2f1ff43d

@ -152,7 +152,7 @@ if (inBrowser) {
// scroll to hash on new tab during dev
if (import.meta.env.DEV && location.hash) {
const target = document.querySelector(location.hash)
const target = document.querySelector(decodeURIComponent(location.hash))
if (target) {
scrollTo(target, location.hash)
}

@ -9,7 +9,7 @@ watch(() => route.path, () => backToTop.value.focus())
function focusOnTargetAnchor({ target }: Event) {
const el = document.querySelector<HTMLAnchorElement>(
(target as HTMLAnchorElement).hash
decodeURIComponent((target as HTMLAnchorElement).hash)
)
if (el) {

Loading…
Cancel
Save