Skip to content

Selectmenu: Support width: false and default to 14em #1467

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

scottgonzalez
Copy link
Member

width: null still matches the width of the original element.
width: false prevents an inline style from being set for the width. This
makes it easy to set the width via a stylesheet and allows the use of any
unit for setting the width, such as the new default of 14em.

Fixes #11198

`width: null` still matches the width of the original element.
`width: false` prevents an inline style from being set for the width. This
makes it easy to set the width via a stylesheet and allows the use of any
unit for setting the width, such as the new default of `14em`.

Fixes #11198
@scottgonzalez
Copy link
Member Author

PR for API change: jquery/api.jqueryui.com#255

@sandygettings
Copy link

Scott: The width property set null matches the width of the original element. The original issue (#11198) is that the default width is insufficient, because the triangle icon take up part of the width. I don't think this fixes #11198.

@scottgonzalez
Copy link
Member Author

The original issue (#11198) is that the default width is insufficient

Right, so we changed the default.

@sandygettings
Copy link

Ah ha, I didn’t understand that. Thanks!

On Mar 4, 2015, at 2:51 PM, Scott González notifications@github.com wrote:

The original issue (#11198) is that the default width is insufficient

Right, so we changed the default.


Reply to this email directly or view it on GitHub #1467 (comment).

@@ -210,7 +212,7 @@ return $.widget( "ui.selectmenu", {
this._getSelectedItem().data( "ui-selectmenu-item" ) || {}
)
);
if ( !this.options.width ) {
if ( this.options.width === null ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this check be consistent with the one above, which uses !== false?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check above is inside _create(); the logic is: if we have any size to set, then do so.

This check is inside refresh(). If there is no inline style (false) or there's an explicit width (anything else beside null), then there's no action to take because the state will already be correct. If the value is null and we're copying the size of the original element, then we need to resize the button because that's something external that can change the behavior.

@tjvantoll
Copy link
Member

👍

@jzaefferer
Copy link
Member

Looks good

@scottgonzalez scottgonzalez deleted the selectmenu-width branch March 5, 2015 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants