@@ -10,7 +10,7 @@ import {FocusKeyManager} from '@angular/cdk/a11y';
10
10
import { Directionality } from '@angular/cdk/bidi' ;
11
11
import { BooleanInput , coerceBooleanProperty } from '@angular/cdk/coercion' ;
12
12
import { SelectionModel } from '@angular/cdk/collections' ;
13
- import { BACKSPACE , END , HOME } from '@angular/cdk/keycodes' ;
13
+ import { END , HOME } from '@angular/cdk/keycodes' ;
14
14
import {
15
15
AfterContentInit ,
16
16
ChangeDetectionStrategy ,
@@ -92,7 +92,6 @@ export class MatChipListChange {
92
92
'(focus)' : 'focus()' ,
93
93
'(blur)' : '_blur()' ,
94
94
'(keydown)' : '_keydown($event)' ,
95
- '(keyup)' : '_keyup($event)' ,
96
95
'[id]' : '_uid' ,
97
96
} ,
98
97
providers : [ { provide : MatFormFieldControl , useExisting : MatChipList } ] ,
@@ -130,9 +129,6 @@ export class MatChipList extends _MatChipListMixinBase implements MatFormFieldCo
130
129
/** Subscription to remove changes in chips. */
131
130
private _chipRemoveSubscription : Subscription | null ;
132
131
133
- /** Used to prevent focus moving to chips while user is holding backspace */
134
- private _focusLastChipOnBackspace : boolean ;
135
-
136
132
/** The chip input to add more chips */
137
133
protected _chipInput : MatChipTextControl ;
138
134
@@ -421,7 +417,6 @@ export class MatChipList extends _MatChipListMixinBase implements MatFormFieldCo
421
417
/** Associates an HTML input element with this chip list. */
422
418
registerInput ( inputElement : MatChipTextControl ) : void {
423
419
this . _chipInput = inputElement ;
424
- this . _focusLastChipOnBackspace = inputElement . empty ;
425
420
}
426
421
427
422
/**
@@ -498,17 +493,6 @@ export class MatChipList extends _MatChipListMixinBase implements MatFormFieldCo
498
493
_keydown ( event : KeyboardEvent ) {
499
494
const target = event . target as HTMLElement ;
500
495
501
- // After input became empty and backspace was pressed again, focus last chip
502
- if ( this . _isInputElement ( target ) ) {
503
- if ( event . keyCode === BACKSPACE && this . _focusLastChipOnBackspace ) {
504
- this . _keyManager . setLastItemActive ( ) ;
505
- event . preventDefault ( ) ;
506
- } else {
507
- this . _focusLastChipOnBackspace = false ;
508
- }
509
- return ;
510
- }
511
-
512
496
if ( target && target . classList . contains ( 'mat-chip' ) ) {
513
497
if ( event . keyCode === HOME ) {
514
498
this . _keyManager . setFirstItemActive ( ) ;
@@ -524,23 +508,6 @@ export class MatChipList extends _MatChipListMixinBase implements MatFormFieldCo
524
508
}
525
509
}
526
510
527
- /**
528
- * Pass events to the keyboard manager. Available here for tests.
529
- */
530
- _keyup ( event : KeyboardEvent ) {
531
- const target = event . target as HTMLElement ;
532
-
533
- // Allow user to move focus to chips next time he presses backspace
534
- if (
535
- ! this . _focusLastChipOnBackspace &&
536
- event . keyCode === BACKSPACE &&
537
- this . _isInputEmpty ( target )
538
- ) {
539
- this . _focusLastChipOnBackspace = true ;
540
- event . preventDefault ( ) ;
541
- }
542
- }
543
-
544
511
/**
545
512
* Check the tab index as you should not be allowed to focus an empty list.
546
513
*/
@@ -577,18 +544,6 @@ export class MatChipList extends _MatChipListMixinBase implements MatFormFieldCo
577
544
return index >= 0 && index < this . chips . length ;
578
545
}
579
546
580
- private _isInputElement ( element : HTMLElement ) : element is HTMLInputElement {
581
- return element && element . nodeName . toLowerCase ( ) === 'input' ;
582
- }
583
-
584
- private _isInputEmpty ( element : HTMLElement ) : boolean {
585
- if ( this . _isInputElement ( element ) ) {
586
- return ! element . value ;
587
- }
588
-
589
- return false ;
590
- }
591
-
592
547
_setSelectionByValue ( value : any , isUserInput : boolean = true ) {
593
548
this . _clearSelection ( ) ;
594
549
this . chips . forEach ( chip => chip . deselect ( ) ) ;
0 commit comments