diff --git a/projects/addon-doc/src/components/navigation/navigation.component.ts b/projects/addon-doc/src/components/navigation/navigation.component.ts index afc0b49a55f3..cca45850d959 100644 --- a/projects/addon-doc/src/components/navigation/navigation.component.ts +++ b/projects/addon-doc/src/components/navigation/navigation.component.ts @@ -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;