From 14b3b607e53aa7c6a186e23be554911d5a56d1f7 Mon Sep 17 00:00:00 2001 From: Alexander Schmitz Date: Mon, 24 Aug 2015 09:04:59 -0400 Subject: [PATCH] Autocomplete: Style updates Ref #14246 --- ui/widgets/autocomplete.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ui/widgets/autocomplete.js b/ui/widgets/autocomplete.js index 954258e23..1ebd6ed7a 100644 --- a/ui/widgets/autocomplete.js +++ b/ui/widgets/autocomplete.js @@ -65,6 +65,7 @@ $.widget( "ui.autocomplete", { pending: 0, _create: function() { + // Some browsers only repeat keydown events, not keypress events, // so we use the suppressKeyPress flag to determine if we've already // handled the keydown event. #7269 @@ -120,8 +121,10 @@ $.widget( "ui.autocomplete", { this._keyEvent( "next", event ); break; case keyCode.ENTER: + // when menu is open and has focus if ( this.menu.active ) { + // #6055 - Opera still allows the keypress to occur // which causes forms to submit suppressKeyPress = true; @@ -140,6 +143,7 @@ $.widget( "ui.autocomplete", { this._value( this.term ); } this.close( event ); + // Different browsers have different default behavior for escape // Single press can mean undo or clear // Double press in IE means clear the whole form @@ -148,6 +152,7 @@ $.widget( "ui.autocomplete", { break; default: suppressKeyPressRepeat = true; + // search timeout should be triggered before the input value is changed this._searchTimeout( event ); break; @@ -210,6 +215,7 @@ $.widget( "ui.autocomplete", { this.menu = $( "