},
_create: function() {
var self = this,
- doc = this.element[ 0 ].ownerDocument;
+ doc = this.element[ 0 ].ownerDocument,
+ suppressKeyPress;
+
this.element
.addClass( "ui-autocomplete-input" )
.attr( "autocomplete", "off" )
return;
}
+ suppressKeyPress = false;
var keyCode = $.ui.keyCode;
switch( event.keyCode ) {
case keyCode.PAGE_UP:
case keyCode.NUMPAD_ENTER:
// when menu is open and has focus
if ( self.menu.active ) {
+ // #6055 - Opera still allows the keypress to occur
+ // which causes forms to submit
+ suppressKeyPress = true;
event.preventDefault();
}
//passthrough - ENTER and TAB both select the current element
break;
}
})
+ .bind( "keypress.autocomplete", function( event ) {
+ if ( suppressKeyPress ) {
+ suppressKeyPress = false;
+ event.preventDefault();
+ }
+ })
.bind( "focus.autocomplete", function() {
if ( self.options.disabled ) {
return;