Skip to content

Commit 475c685

Browse files
authored
fix: scroll failed when both toc and article needs scroll (#9321)
1 parent ebf6716 commit 475c685

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

templates/modern/src/toc.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ export async function renderToc(): Promise<TocNode[]> {
4848
const lastActiveElement = activeElements[activeElements.length - 1]
4949
if (lastActiveElement) {
5050
lastActiveElement.scrollIntoView({ block: 'nearest' })
51+
/* eslint-disable no-self-assign */
52+
if (location.hash) {
53+
location.href = location.href
54+
}
5155
}
5256
}
5357

0 commit comments

Comments
 (0)