@@ -24,13 +24,14 @@ import {
2424 ListTypeaheadItem ,
2525} from '../list-typeahead/list-typeahead' ;
2626
27- /** The selection operations that the list can perform. */
28- interface SelectOptions {
27+ /** The operations that the list can perform after navigation . */
28+ interface NavOptions {
2929 toggle ?: boolean ;
3030 select ?: boolean ;
3131 selectOne ?: boolean ;
3232 selectRange ?: boolean ;
3333 anchor ?: boolean ;
34+ focusElement ?: boolean ;
3435}
3536
3637/** Represents an item in the list. */
@@ -105,28 +106,28 @@ export class List<T extends ListItem<V>, V> {
105106 }
106107
107108 /** Navigates to the first option in the list. */
108- first ( opts ?: SelectOptions ) {
109- this . _navigate ( opts , ( ) => this . navigationBehavior . first ( ) ) ;
109+ first ( opts ?: NavOptions ) {
110+ this . _navigate ( opts , ( ) => this . navigationBehavior . first ( opts ) ) ;
110111 }
111112
112113 /** Navigates to the last option in the list. */
113- last ( opts ?: SelectOptions ) {
114- this . _navigate ( opts , ( ) => this . navigationBehavior . last ( ) ) ;
114+ last ( opts ?: NavOptions ) {
115+ this . _navigate ( opts , ( ) => this . navigationBehavior . last ( opts ) ) ;
115116 }
116117
117118 /** Navigates to the next option in the list. */
118- next ( opts ?: SelectOptions ) {
119- this . _navigate ( opts , ( ) => this . navigationBehavior . next ( ) ) ;
119+ next ( opts ?: NavOptions ) {
120+ this . _navigate ( opts , ( ) => this . navigationBehavior . next ( opts ) ) ;
120121 }
121122
122123 /** Navigates to the previous option in the list. */
123- prev ( opts ?: SelectOptions ) {
124- this . _navigate ( opts , ( ) => this . navigationBehavior . prev ( ) ) ;
124+ prev ( opts ?: NavOptions ) {
125+ this . _navigate ( opts , ( ) => this . navigationBehavior . prev ( opts ) ) ;
125126 }
126127
127128 /** Navigates to the given item in the list. */
128- goto ( item : T , opts ?: SelectOptions ) {
129- this . _navigate ( opts , ( ) => this . navigationBehavior . goto ( item ) ) ;
129+ goto ( item : T , opts ?: NavOptions ) {
130+ this . _navigate ( opts , ( ) => this . navigationBehavior . goto ( item , opts ) ) ;
130131 }
131132
132133 /** Removes focus from the list. */
@@ -140,7 +141,7 @@ export class List<T extends ListItem<V>, V> {
140141 }
141142
142143 /** Handles typeahead search navigation for the list. */
143- search ( char : string , opts ?: SelectOptions ) {
144+ search ( char : string , opts ?: NavOptions ) {
144145 this . _navigate ( opts , ( ) => this . typeaheadBehavior . search ( char ) ) ;
145146 }
146147
@@ -190,7 +191,7 @@ export class List<T extends ListItem<V>, V> {
190191 }
191192
192193 /** Handles updating selection for the list. */
193- updateSelection ( opts : SelectOptions = { anchor : true } ) {
194+ updateSelection ( opts : NavOptions = { anchor : true } ) {
194195 if ( opts . toggle ) {
195196 this . selectionBehavior . toggle ( ) ;
196197 }
@@ -217,7 +218,7 @@ export class List<T extends ListItem<V>, V> {
217218 * Handles boilerplate calling of focus & selection operations. Also ensures these
218219 * additional operations are only called if the navigation operation moved focus to a new option.
219220 */
220- private _navigate ( opts : SelectOptions = { } , operation : ( ) => boolean ) {
221+ private _navigate ( opts : NavOptions = { } , operation : ( ) => boolean ) {
221222 if ( opts ?. selectRange ) {
222223 this . _wrap . set ( false ) ;
223224 this . selectionBehavior . rangeStartIndex . set ( this . _anchorIndex ( ) ) ;
0 commit comments