Skip to content

Commit

Permalink
fix(select): scroll into selected option on open (#2859)
Browse files Browse the repository at this point in the history
  • Loading branch information
evtkhvch authored Nov 8, 2021
1 parent e30e00c commit 1c02e15
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/framework/theme/components/select/select.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -914,7 +914,11 @@ export class NbSelectComponent
show() {
if (this.isHidden) {
this.attachToOverlay();
this.setActiveOption();

this.positionStrategy.positionChange.pipe(take(1), takeUntil(this.destroy$)).subscribe(() => {
this.setActiveOption();
});

this.cd.markForCheck();
}
}
Expand Down

0 comments on commit 1c02e15

Please sign in to comment.