@@ -120,8 +120,7 @@ export class TreeKeyManager<T extends TreeKeyManagerItem> {
120120 * Predicate function that can be used to check whether an item should be skipped
121121 * by the key manager. By default, disabled items are skipped.
122122 */
123- private _skipPredicateFn = ( item : T ) =>
124- typeof item . isDisabled === 'boolean' ? item . isDisabled : ! ! item . isDisabled ?.( ) ;
123+ private _skipPredicateFn = ( item : T ) => this . _isItemDisabled ( item ) ;
125124
126125 /** Function to determine equivalent items. */
127126 private _trackByFn : ( item : T ) => unknown = ( item : T ) => item ;
@@ -313,7 +312,7 @@ export class TreeKeyManager<T extends TreeKeyManagerItem> {
313312
314313 private _findNextAvailableItemIndex ( startingIndex : number ) {
315314 for ( let i = startingIndex + 1 ; i < this . _items . length ; i ++ ) {
316- if ( ! this . _isItemDisabled ( this . _items [ i ] ) ) {
315+ if ( ! this . _skipPredicateFn ( this . _items [ i ] ) ) {
317316 return i ;
318317 }
319318 }
@@ -322,7 +321,7 @@ export class TreeKeyManager<T extends TreeKeyManagerItem> {
322321
323322 private _findPreviousAvailableItemIndex ( startingIndex : number ) {
324323 for ( let i = startingIndex - 1 ; i >= 0 ; i -- ) {
325- if ( ! this . _isItemDisabled ( this . _items [ i ] ) ) {
324+ if ( ! this . _skipPredicateFn ( this . _items [ i ] ) ) {
326325 return i ;
327326 }
328327 }
@@ -341,7 +340,7 @@ export class TreeKeyManager<T extends TreeKeyManagerItem> {
341340 this . _activeItem . collapse ( ) ;
342341 } else {
343342 const parent = this . _activeItem . getParent ( ) ;
344- if ( ! parent || this . _isItemDisabled ( parent ) ) {
343+ if ( ! parent || this . _skipPredicateFn ( parent as T ) ) {
345344 return ;
346345 }
347346 this . _setActiveItem ( parent as T ) ;
@@ -362,7 +361,7 @@ export class TreeKeyManager<T extends TreeKeyManagerItem> {
362361 coerceObservable ( this . _activeItem . getChildren ( ) )
363362 . pipe ( take ( 1 ) )
364363 . subscribe ( children => {
365- const firstChild = children . find ( child => ! this . _isItemDisabled ( child ) ) ;
364+ const firstChild = children . find ( child => ! this . _skipPredicateFn ( child as T ) ) ;
366365 if ( ! firstChild ) {
367366 return ;
368367 }
0 commit comments