Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#10145 closed bug (fixed)

Selectmenu: Incorrect size when original select has CSS width 100%

Reported by: spjonez Owned by:
Priority: minor Milestone: 1.11.1
Component: ui.selectmenu Version: 1.11.0
Keywords: Cc:
Blocked by: Blocking:

Description

Select list does not use the correct size when placed in an inline-block container with a specific width and the original select is set to width 100%.

Fiddle: http://jsfiddle.net/Mwzhs/

Change History (5)

comment:1 Changed 3 years ago by spjonez

To fix this bug make the following two changes:

Move lines 82/83 under this._setOption( "width", this.options.width ); currently the original element is hidden before the width is calculated so outerWidth reports an incorrect size.

In the original there is a slight difference in this code, the original set this.button.width and in 1.11 it sets outerWidth. I tested both versions and it's a few pixels off with outerWidth. It should be this:

if ( key === "width" ) {

if ( !value ) {

value = this.element.outerWidth();

}

this.button.width( value );

}

Last edited 3 years ago by spjonez (previous) (diff)

comment:2 Changed 3 years ago by tj.vantoll

  • Status changed from new to open
  • Summary changed from Incorrect size when original select has CSS width 100% to Selectmenu: Incorrect size when original select has CSS width 100%

This seems reasonable to me as calling .width() and .outerWidth() on the original <select> element in this test case both return 300.

comment:4 Changed 3 years ago by Scott González

  • Resolution set to fixed
  • Status changed from open to closed

Selectmenu: Properly set width for button

Fixes #10145 Closes gh-1296

Changeset: 45e13ed208b3533e91d008789d61e5138501428a

comment:5 Changed 3 years ago by scottgonzalez

  • Milestone changed from none to 1.11.1
Note: See TracTickets for help on using tickets.