diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 0e62ccfdb62..7fee70c2f28 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -47,6 +47,7 @@ $.widget( "ui.autocomplete", { _create: function() { var self = this, doc = this.element[ 0 ].ownerDocument, + appendToEl = $( this.options.appendTo || "body", doc ), suppressKeyPress; this.valueMethod = this.element[ this.element.is( "input" ) ? "val" : "text" ]; @@ -170,13 +171,25 @@ $.widget( "ui.autocomplete", { self._change( event ); }, 150 ); }); + + // dragging or resizing the appendTo element or any of its descendants should + // cause the menu's position to be recalculated + appendToEl.bind( "drag.autocomplete, resize.autocomplete", function( event ) { + if ( self.menu.element.is(":hidden") ) return; + setTimeout( function() { + self.menu.element.position( $.extend({ + of: self.element + }, self.options.position )).zIndex( self.element.zIndex() + 1 ); + }, 0 ); + }); + this._initSource(); this.response = function() { return self._response.apply( self, arguments ); }; this.menu = $( "