Skip to content

Commit 325a262

Browse files
committed
Autocomplete: Use .outerWidth() for determining the size of the menu. Fixes #5832 - Autocomplete: menu has incorrect width.
1 parent ba749ba commit 325a262

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

ui/jquery.ui.autocomplete.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,13 @@ $.widget( "ui.autocomplete", {
276276
collision: "none"
277277
});
278278

279-
menuWidth = ul.width( "" ).width();
280-
textWidth = this.element.width();
281-
ul.width( Math.max( menuWidth, textWidth ) );
279+
menuWidth = ul.width( "" ).outerWidth();
280+
textWidth = this.element.outerWidth();
281+
ul.width( Math.max( menuWidth, textWidth )
282+
- ( parseFloat( ul.css("paddingLeft") ) || 0 )
283+
- ( parseFloat( ul.css("paddingRight") ) || 0 )
284+
- ( parseFloat( ul.css("borderLeftWidth") ) || 0 )
285+
- ( parseFloat( ul.css("borderRightWidth") ) || 0 ) );
282286
},
283287

284288
_renderMenu: function( ul, items ) {

0 commit comments

Comments
 (0)