diff --git a/frontend/src/app/shared/directives/search-highlight.directive.ts b/frontend/src/app/shared/directives/search-highlight.directive.ts index f09cf82431..9ff6204d52 100644 --- a/frontend/src/app/shared/directives/search-highlight.directive.ts +++ b/frontend/src/app/shared/directives/search-highlight.directive.ts @@ -15,8 +15,13 @@ export class OpSearchHighlightDirective implements AfterViewChecked { ngAfterViewChecked():void { let el = this.elementRef.nativeElement as HTMLElement; - el = this.cleanUpOldHighlighting(el); + const highlightedElement = el.querySelector('.op-search-highlight'); + if (!!highlightedElement && highlightedElement.innerHTML.toLocaleLowerCase() === this.query) { + return; + } + + el = this.cleanUpOldHighlighting(el); if (!this.query) { return; }