Skip to content

Commit d7ac564

Browse files
yufeihp-kostov
authored andcommitted
fix: anchor sometimes failed to scroll (dotnet#9251)
* fix: anchor sometimes failed to scroll * fix lint * fix test --------- Co-authored-by: Yufei Huang <yufeih@users.noreply.github.com>
1 parent 29f1ee1 commit d7ac564

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

templates/modern/src/markdown.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ function renderAnchor() {
169169
}, window.docfx.anchors)
170170

171171
anchors.add('article h2:not(.no-anchor), article h3:not(.no-anchor), article h4:not(.no-anchor)')
172+
173+
/* eslint-disable no-self-assign */
174+
if (location.hash) {
175+
location.href = location.href
176+
}
172177
}
173178

174179
/**

0 commit comments

Comments
 (0)