diff --git a/src/components/chips/js/chipsController.js b/src/components/chips/js/chipsController.js index 49935d6cd70..b4e868c69d8 100644 --- a/src/components/chips/js/chipsController.js +++ b/src/components/chips/js/chipsController.js @@ -83,22 +83,18 @@ * @param event */ MdChipsCtrl.prototype.inputKeydown = function(event) { - var chipBuffer; + var chipBuffer = this.getChipBuffer(); switch (event.keyCode) { case this.$mdConstant.KEY_CODE.ENTER: - if (this.$scope.requireMatch) break; - chipBuffer = this.getChipBuffer(); - if (chipBuffer) { - event.preventDefault(); - this.appendChip(chipBuffer); - this.resetChipBuffer(); - } + if (this.$scope.requireMatch || !chipBuffer) break; + event.preventDefault(); + this.appendChip(chipBuffer); + this.resetChipBuffer(); break; case this.$mdConstant.KEY_CODE.BACKSPACE: - if (!event.target.value.length) { - event.stopPropagation(); - if (this.items.length) this.selectAndFocusChipSafe(this.items.length - 1); - } + if (chipBuffer) break; + event.stopPropagation(); + if (this.items.length) this.selectAndFocusChipSafe(this.items.length - 1); break; } }; @@ -109,6 +105,7 @@ * @param event */ MdChipsCtrl.prototype.chipKeydown = function (event) { + if (this.getChipBuffer()) return; switch (event.keyCode) { case this.$mdConstant.KEY_CODE.BACKSPACE: case this.$mdConstant.KEY_CODE.DELETE: