@@ -18,7 +18,7 @@ import { IgxButtonModule } from '../directives/button/button.directive';
18
18
import { IgxForOfModule } from '../directives/for-of/for_of.directive' ;
19
19
import { IgxRippleModule } from '../directives/ripple/ripple.directive' ;
20
20
import { IgxTextSelectionModule } from '../directives/text-selection/text-selection.directive' ;
21
- import { IgxToggleModule } from '../directives/toggle/toggle.directive' ;
21
+ import { IgxToggleDirective , IgxToggleModule } from '../directives/toggle/toggle.directive' ;
22
22
import { IgxDropDownModule } from '../drop-down/public_api' ;
23
23
import { IgxIconModule , IgxIconService } from '../icon/public_api' ;
24
24
import { IgxInputGroupModule , IgxInputGroupType , IGX_INPUT_GROUP_TYPE } from '../input-group/public_api' ;
@@ -147,9 +147,19 @@ export class IgxSimpleComboComponent extends IgxComboBaseDirective implements Co
147
147
this . comboInput . focus ( ) ;
148
148
}
149
149
if ( this . comboInput . value . length === 0 ) {
150
- this . dropdown . focusedItem = this . dropdown . items [ 0 ] ;
150
+ this . dropdown . navigateFirst ( ) ;
151
151
this . dropdownContainer . nativeElement . focus ( ) ;
152
152
}
153
+ if ( this . selection . length > 0 ) {
154
+ const index = this . virtDir . igxForOf . findIndex ( e => {
155
+ let current = e [ this . valueKey ] ;
156
+ if ( this . valueKey === null || this . valueKey === undefined ) {
157
+ current = e ;
158
+ }
159
+ return current === this . selection [ 0 ] ;
160
+ } ) ;
161
+ this . dropdown . navigateItem ( index ) ;
162
+ }
153
163
} ) ;
154
164
this . dropdown . closed . pipe ( takeUntil ( this . destroy$ ) ) . subscribe ( ( ) => {
155
165
this . composing = false ;
@@ -169,7 +179,7 @@ export class IgxSimpleComboComponent extends IgxComboBaseDirective implements Co
169
179
this . _onChangeCallback ( this . searchValue ) ;
170
180
if ( this . collapsed ) {
171
181
this . open ( ) ;
172
- this . virtDir . scrollTo ( 0 ) ;
182
+ this . dropdown . navigateFirst ( ) ;
173
183
}
174
184
super . handleInputChange ( event ) ;
175
185
}
@@ -223,6 +233,7 @@ export class IgxSimpleComboComponent extends IgxComboBaseDirective implements Co
223
233
this . clearSelection ( true ) ;
224
234
if ( this . collapsed ) {
225
235
this . open ( ) ;
236
+ this . dropdown . navigateFirst ( ) ;
226
237
} else {
227
238
this . focusSearchInput ( true ) ;
228
239
}
0 commit comments