From bef7f1b15b1576c87faad1eb36458921c2443f30 Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Fri, 27 Jan 2012 00:06:02 +0100 Subject: [PATCH] Selectmenu: click an optgroup header should not close the menu --- ui/jquery.ui.selectmenu.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index 6cb2c3014..46289677b 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -253,7 +253,13 @@ $.widget( "ui.selectmenu", { $.each( items, function( index, item ) { if ( item.optgroup != currentOptgroup ) { - var optgroup = $( '
  • ' + item.optgroup + '
  • ' ); + var optgroup = $( '
  • ', { + 'class': 'ui-selectmenu-optgroup', + html: item.optgroup, + click: function( event ){ + event.stopPropagation(); + } + }); if ( item.element.parent( "optgroup" ).attr( "disabled" ) ) optgroup.addClass( 'ui-state-disabled' ); ul.append( optgroup ); currentOptgroup = item.optgroup;