Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Avoid too often replacement of highlighted strings

Henriette Dargef73aa18a006d
diff --git a/frontend/src/app/shared/directives/search-highlight.directive.ts b/frontend/src/app/shared/directives/search-highlight.directive.ts
index f09cf82431c..9ff6204d52a 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;
}