-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Selectmenu: Fix selecting options following hidden ones #2144
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -354,7 +354,12 @@ return $.widget( "ui.selectmenu", [ $.ui.formResetMixin, { | |
if ( item.disabled ) { | ||
this._addClass( li, null, "ui-state-disabled" ); | ||
} | ||
this._setText( wrapper, item.label ); | ||
|
||
if ( item.hidden ) { | ||
li.prop( "hidden", true ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure about adding hidden prop here. We don't do that anywhere else. But it seems there is no other usage of the hidden attribute, so there is nothing to compare it to directly. What about using "aria-hidden" attribute and "ui-helper-hidden" CSS class? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @fnagel Sure, I can change the code. The behavior in IE 9 & 10 will be different but perhaps if the One thing - I see the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure about my proposed change either :-D Just wanted to point out our options and get your opinion on it. You are right, Maybe its best to use it as is it is (with the hidden property) and let the client (or its assistive technology) decide what to do. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In that case, I think I'd leave it at |
||
} else { | ||
this._setText( wrapper, item.label ); | ||
} | ||
|
||
return li.append( wrapper ).appendTo( ul ); | ||
}, | ||
|
@@ -658,10 +663,6 @@ return $.widget( "ui.selectmenu", [ $.ui.formResetMixin, { | |
var that = this, | ||
data = []; | ||
options.each( function( index, item ) { | ||
if ( item.hidden ) { | ||
return; | ||
} | ||
|
||
data.push( that._parseOption( $( item ), index ) ); | ||
} ); | ||
this.items = data; | ||
|
@@ -675,6 +676,7 @@ return $.widget( "ui.selectmenu", [ $.ui.formResetMixin, { | |
index: index, | ||
value: option.val(), | ||
label: option.text(), | ||
hidden: optgroup.prop( "hidden" ) || option.prop( "hidden" ), | ||
optgroup: optgroup.attr( "label" ) || "", | ||
disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" ) | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to change the test as the options are now back in the DOM, just hidden.