From 4307aa8486d63f07dc7cc0f156d4cf913a630928 Mon Sep 17 00:00:00 2001 From: evtkhvch Date: Tue, 7 Sep 2021 11:16:06 +0300 Subject: [PATCH 1/2] fix(select): show active option --- src/framework/theme/components/select/select.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/framework/theme/components/select/select.component.ts b/src/framework/theme/components/select/select.component.ts index 33dc6ec41c..511f0d90e8 100644 --- a/src/framework/theme/components/select/select.component.ts +++ b/src/framework/theme/components/select/select.component.ts @@ -902,7 +902,7 @@ export class NbSelectComponent implements OnChanges, AfterViewInit, AfterContent show() { if (this.isHidden) { this.attachToOverlay(); - this.setActiveOption(); + setTimeout(() => this.setActiveOption()) this.cd.markForCheck(); } } From 783c1e0c625a51cb812b10acdd94415c198c1697 Mon Sep 17 00:00:00 2001 From: kolyaevtikhovich Date: Fri, 17 Sep 2021 12:58:20 +0300 Subject: [PATCH 2/2] fix(select): set active when position has changed --- src/framework/theme/components/select/select.component.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/framework/theme/components/select/select.component.ts b/src/framework/theme/components/select/select.component.ts index 511f0d90e8..17477bd938 100644 --- a/src/framework/theme/components/select/select.component.ts +++ b/src/framework/theme/components/select/select.component.ts @@ -31,7 +31,7 @@ import { import { NgClass } from '@angular/common'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { merge, Subject, BehaviorSubject, from } from 'rxjs'; -import { startWith, switchMap, takeUntil, filter, map, finalize } from 'rxjs/operators'; +import { startWith, switchMap, takeUntil, filter, map, finalize, take } from 'rxjs/operators'; import { NbStatusService } from '../../services/status.service'; import { @@ -902,7 +902,11 @@ export class NbSelectComponent implements OnChanges, AfterViewInit, AfterContent show() { if (this.isHidden) { this.attachToOverlay(); - setTimeout(() => this.setActiveOption()) + + this.positionStrategy.positionChange.pipe(take(1), takeUntil(this.destroy$)).subscribe(() => { + this.setActiveOption(); + }); + this.cd.markForCheck(); } }