Skip to content

Commit 6d542ff

Browse files
committed
fix(chips): fix chip list focus and keyboard behaviors
1 parent 3571f68 commit 6d542ff

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/lib/chips/chip-list.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {FocusKeyManager} from '@angular/cdk/a11y';
1010
import {Directionality} from '@angular/cdk/bidi';
1111
import {coerceBooleanProperty} from '@angular/cdk/coercion';
1212
import {SelectionModel} from '@angular/cdk/collections';
13-
import {BACKSPACE, DELETE, LEFT_ARROW, RIGHT_ARROW, UP_ARROW} from '@angular/cdk/keycodes';
13+
import {BACKSPACE, DELETE, LEFT_ARROW, RIGHT_ARROW} from '@angular/cdk/keycodes';
1414
import {startWith} from '@angular/cdk/rxjs';
1515
import {
1616
AfterContentInit,
@@ -432,8 +432,8 @@ export class MdChipList implements MdFormFieldControl<any>, ControlValueAccessor
432432

433433
let isPrevKey = (code === (isRtl ? RIGHT_ARROW : LEFT_ARROW));
434434
let isNextKey = (code === (isRtl ? LEFT_ARROW : RIGHT_ARROW));
435-
let isBackKey = (code === BACKSPACE || code == DELETE || code == UP_ARROW || isPrevKey);
436-
// If they are on an empty input and hit backspace/delete/left arrow, focus the last chip
435+
let isBackKey = code === BACKSPACE;
436+
// If they are on an empty input and hit backspace, focus the last chip
437437
if (isInputEmpty && isBackKey) {
438438
this._keyManager.setLastItemActive();
439439
event.preventDefault();
@@ -504,8 +504,6 @@ export class MdChipList implements MdFormFieldControl<any>, ControlValueAccessor
504504
if (focusChip) {
505505
focusChip.focus();
506506
}
507-
} else if (chipsArray.length === 0) {
508-
this._focusInput();
509507
}
510508

511509
// Reset our destroyed index

0 commit comments

Comments
 (0)