aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2010-03-11 03:28:00 +0000
committerScott González <scott.gonzalez@gmail.com>2010-03-11 03:28:00 +0000
commit5f213572d611a01328bfd22313e807aa656feb24 (patch)
tree95a9ac0dbcc54e1fe4181bc8fc939a7f23d2c969 /ui
parent8cd7129f0c9a1b2332aaec6ca770ead19c845531 (diff)
downloadjquery-ui-5f213572d611a01328bfd22313e807aa656feb24.tar.gz
jquery-ui-5f213572d611a01328bfd22313e807aa656feb24.zip
Autocomplete: Append menu to body and reset z-index on every suggestion.
Fixes #5271.
Diffstat (limited to 'ui')
-rw-r--r--ui/jquery.ui.autocomplete.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js
index 226b2b1b4..3cb031b1e 100644
--- a/ui/jquery.ui.autocomplete.js
+++ b/ui/jquery.ui.autocomplete.js
@@ -20,7 +20,8 @@ $.widget( "ui.autocomplete", {
delay: 300
},
_create: function() {
- var self = this;
+ var self = this,
+ doc = this.element[ 0 ].ownerDocument;
this.element
.addClass( "ui-autocomplete-input" )
.attr( "autocomplete", "off" )
@@ -95,7 +96,7 @@ $.widget( "ui.autocomplete", {
};
this.menu = $( "<ul></ul>" )
.addClass( "ui-autocomplete" )
- .appendTo( this.element.parent() )
+ .appendTo( "body", doc )
.menu({
focus: function( event, ui ) {
var item = ui.item.data( "item.autocomplete" );
@@ -112,7 +113,7 @@ $.widget( "ui.autocomplete", {
self.close( event );
self.previous = self.element.val();
// only trigger when focus was lost (click on menu)
- if ( self.element[0] != document.activeElement ) {
+ if ( self.element[0] !== doc.activeElement ) {
self.element.focus();
}
}
@@ -232,7 +233,9 @@ $.widget( "ui.autocomplete", {
_suggest: function( items ) {
var self = this,
- ul = this.menu.element.empty();
+ ul = this.menu.element
+ .empty()
+ .zIndex( this.element.zIndex() + 1 );
this._renderMenu( ul, items );
// TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate
this.menu.deactivate();