Skip to content

Commit bef7f1b

Browse files
committed
Selectmenu: click an optgroup header should not close the menu
1 parent 827a8cb commit bef7f1b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ui/jquery.ui.selectmenu.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,13 @@ $.widget( "ui.selectmenu", {
253253

254254
$.each( items, function( index, item ) {
255255
if ( item.optgroup != currentOptgroup ) {
256-
var optgroup = $( '<li class="ui-selectmenu-optgroup">' + item.optgroup + '</li>' );
256+
var optgroup = $( '<li />', {
257+
'class': 'ui-selectmenu-optgroup',
258+
html: item.optgroup,
259+
click: function( event ){
260+
event.stopPropagation();
261+
}
262+
});
257263
if ( item.element.parent( "optgroup" ).attr( "disabled" ) ) optgroup.addClass( 'ui-state-disabled' );
258264
ul.append( optgroup );
259265
currentOptgroup = item.optgroup;

0 commit comments

Comments
 (0)