@@ -300,7 +300,6 @@ export class MatListOption extends _MatListOptionMixinBase
300
300
'role' : 'listbox' ,
301
301
'[tabIndex]' : 'tabIndex' ,
302
302
'class' : 'mat-selection-list mat-list-base' ,
303
- '(focus)' : 'focus()' ,
304
303
'(blur)' : '_onTouched()' ,
305
304
'(keydown)' : '_keydown($event)' ,
306
305
'aria-multiselectable' : 'true' ,
@@ -416,7 +415,7 @@ export class MatSelectionList extends _MatSelectionListMixinBase implements Focu
416
415
this . _modelChanges . unsubscribe ( ) ;
417
416
}
418
417
419
- /** Focuses the last active list option . */
418
+ /** Focuses the selection list. */
420
419
focus ( ) {
421
420
this . _element . nativeElement . focus ( ) ;
422
421
}
@@ -444,11 +443,12 @@ export class MatSelectionList extends _MatSelectionListMixinBase implements Focu
444
443
const optionIndex = this . _getOptionIndex ( option ) ;
445
444
446
445
if ( optionIndex > - 1 && this . _keyManager . activeItemIndex === optionIndex ) {
446
+ const options = this . options . toArray ( ) ;
447
447
// Check whether the option is the last item
448
448
if ( optionIndex > 0 ) {
449
- this . _keyManager . updateActiveItemIndex ( optionIndex - 1 ) ;
450
- } else if ( optionIndex === 0 && this . options . length > 1 ) {
451
- this . _keyManager . updateActiveItemIndex ( Math . min ( optionIndex + 1 , this . options . length - 1 ) ) ;
449
+ this . _keyManager . updateActiveItem ( options [ optionIndex - 1 ] ) ;
450
+ } else if ( optionIndex === 0 && options . length > 1 ) {
451
+ this . _keyManager . updateActiveItem ( options [ Math . min ( optionIndex + 1 , options . length - 1 ) ] ) ;
452
452
}
453
453
}
454
454
0 commit comments