Skip to content

Commit

Permalink
fix(filter-field): Fixes an issue where suggestions are not displayed…
Browse files Browse the repository at this point in the history
… in MS Edge.

When not using Ivy but View Engine, MS Edge did not display any suggestions.

Closes dynatrace-oss#1558
  • Loading branch information
samuelfahrngruber committed Sep 15, 2020
1 parent fe16de0 commit 4a3f5a1
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions libs/barista-components/highlight/src/highlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import {
Optional,
ViewChild,
ViewEncapsulation,
AfterContentInit,
} from '@angular/core';
import { Subscription } from 'rxjs';
import { take } from 'rxjs/operators';
Expand Down Expand Up @@ -78,12 +77,7 @@ function escapeRegExp(text: string): string {
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class DtHighlight
implements
AfterContentChecked,
AfterContentInit,
AfterViewInit,
OnChanges,
OnDestroy {
implements AfterContentChecked, AfterViewInit, OnChanges, OnDestroy {
/**
* The caseSensitive input can be set to search for case sensitive occurrences.
* Per default the search is case insensitive.
Expand Down Expand Up @@ -140,6 +134,14 @@ export class DtHighlight
}

ngAfterViewInit(): void {
// Initially we need to run and force highlight once
// to move the text content value into the visible span
// Otherwise some layouts will be tripped up, as the visible span
// would be 0x0 pixels large.
const textContent = this._getTextContent();
this._textContent = textContent;
this._highlight(true);

// Observable whether the component is in the viewport.
this._isInViewportSubscription = createInViewportStream(
this._elementRef,
Expand All @@ -152,16 +154,6 @@ export class DtHighlight
});
}

ngAfterContentInit(): void {
// Initially we need to run and force highlight once
// to move the text content value into the visible span
// Otherwise some layouts will be tripped up, as the visible span
// would be 0x0 pixels large.
const textContent = this._getTextContent();
this._textContent = textContent;
this._highlight(true);
}

ngOnDestroy(): void {
this._isInViewportSubscription.unsubscribe();
}
Expand Down

0 comments on commit 4a3f5a1

Please sign in to comment.