Skip to content

Commit

Permalink
fix(addon-doc): scroll to last element in DOM if there are several (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode authored Nov 10, 2022
1 parent 1a258c5 commit 883db38
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ export class TuiDocNavigationComponent {
}

private navigateToAnchorLink(fragment: string): void {
const element = fragment && this.documentRef.querySelector(`#${fragment}`);
const nodes = this.documentRef.querySelectorAll(`#${fragment}`);
const element = fragment && nodes.length && nodes[nodes.length - 1];

if (!element) {
return;
Expand Down

0 comments on commit 883db38

Please sign in to comment.