Skip to content

Commit

Permalink
fix: autocomplete init position
Browse files Browse the repository at this point in the history
  • Loading branch information
igauch committed Apr 13, 2023
1 parent 3ec3932 commit 2e27870
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/autocomplete/autocomplete.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
switchMap,
tap,
withLatestFrom,
first,
} from 'rxjs';

import { publishRef } from '../utils';
Expand Down Expand Up @@ -93,6 +94,16 @@ export class AutocompleteComponent implements AfterContentInit {
([hasVisibleSuggestion, hasPlaceholder]) =>
hasVisibleSuggestion || hasPlaceholder,
),
distinctUntilChanged(),
tap(hasContent => {
if (hasContent) {
this.directive$$.pipe(first()).subscribe(directive => {
window.requestAnimationFrame(() => {
directive.overlayRef.updatePosition();
});
});
}
}),
);
}
}

0 comments on commit 2e27870

Please sign in to comment.