Skip to content

Commit

Permalink
fix: anchor sometimes failed to scroll (dotnet#9251)
Browse files Browse the repository at this point in the history
* fix: anchor sometimes failed to scroll

* fix lint

* fix test

---------

Co-authored-by: Yufei Huang <[email protected]>
  • Loading branch information
2 people authored and p-kostov committed Jun 28, 2024
1 parent 29f1ee1 commit d7ac564
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions templates/modern/src/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ function renderAnchor() {
}, window.docfx.anchors)

anchors.add('article h2:not(.no-anchor), article h3:not(.no-anchor), article h4:not(.no-anchor)')

/* eslint-disable no-self-assign */
if (location.hash) {
location.href = location.href
}
}

/**
Expand Down

0 comments on commit d7ac564

Please sign in to comment.