From ea053b1991424c57536ccb19948ed1e74d3542ed Mon Sep 17 00:00:00 2001 From: Pawel Kozlowski Date: Fri, 20 Dec 2013 16:40:56 +0100 Subject: [PATCH] revert(typeahead): prevent accidental form submission on ENTER Closes #1298 This reverts commit 253c49ff26c1bb6c324a0549bc51ee4f45f66429. --- src/typeahead/test/typeahead.spec.js | 8 -------- src/typeahead/typeahead.js | 3 --- 2 files changed, 11 deletions(-) diff --git a/src/typeahead/test/typeahead.spec.js b/src/typeahead/test/typeahead.spec.js index 860cc9e8af..5b14b27ae7 100644 --- a/src/typeahead/test/typeahead.spec.js +++ b/src/typeahead/test/typeahead.spec.js @@ -60,7 +60,6 @@ describe('typeahead tests', function () { var e = $.Event("keydown"); e.which = keyCode; inputEl.trigger(e); - return e; }; //custom matchers @@ -439,13 +438,6 @@ describe('typeahead tests', function () { expect($scope.isLoading).toBeFalsy(); }); - it('pr 1165 - prevent default on ENTER to avoid accidental form submission', function () { - var element = prepareInputEl("
"); - var e = triggerKeyDown(element, 13); - - expect(e.isDefaultPrevented()).toBeTruthy(); - }); - it('does not close matches popup on click in input', function () { var element = prepareInputEl("
"); var inputEl = findInput(element); diff --git a/src/typeahead/typeahead.js b/src/typeahead/typeahead.js index 93a8e1427a..0a21be5e6c 100644 --- a/src/typeahead/typeahead.js +++ b/src/typeahead/typeahead.js @@ -230,9 +230,6 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap //typeahead is open and an "interesting" key was pressed if (scope.matches.length === 0 || HOT_KEYS.indexOf(evt.which) === -1) { - if (evt.which === 13) { - evt.preventDefault(); - } return; }