Skip to content
Permalink
Browse files

Selectmenu: fixed disabled status of the widget (keyboard control)

  • Loading branch information
fnagel committed Sep 28, 2011
1 parent c0ea81a commit a438ec3b7d54f5b557208c2af4240d1daca06f5d
Showing with 13 additions and 7 deletions.
  1. +2 −2 themes/base/jquery.ui.selectmenu.css
  2. +11 −5 ui/jquery.ui.selectmenu.js
@@ -10,8 +10,8 @@

.ui-selectmenu-menu { padding: 0; margin: 0; position:absolute; top: 0; display: none; }
.ui-selectmenu-menu .ui-menu .ui-menu-item { width: auto; }
.ui-selectmenu-menu .ui-menu .ui-menu-item a { padding: 0.3em 1em 0.3em 1em; }
.ui-selectmenu-menu .ui-menu li.ui-state-disabled { margin: 0; padding: 0; }
.ui-selectmenu-menu .ui-menu .ui-menu-item a { padding: 0.3em 1em 0.3em 1em; }
.ui-selectmenu-menu .ui-menu li.ui-state-disabled { padding: 0.3em 1em 0.3em 1em; }
.ui-selectmenu-menu .ui-menu li.ui-selectmenu-optgroup { font-weight: bold; line-height: 1.5; padding: 2px 0.4em; margin: 0.5em 0 0 0; }
.ui-selectmenu-open { display: block; }

@@ -313,17 +313,21 @@ $.widget( "ui.selectmenu", {
},

_renderItem: function( ul, item) {
return $( "<li />" )
.addClass( ( item.disabled ) ? 'ui-state-disabled' : '' )
.data( "item.selectmenu", item )
.append( $( "<a />", {
var li = $( "<li />" ).data( "item.selectmenu", item );
if ( item.disabled ) {
li.addClass( 'ui-state-disabled' ).text( item.label );
} else {
li.append( $( "<a />", {
text: item.label,
href: '#',
click: function( event ) {
event.preventDefault();
}
})
).appendTo( ul );
);
}

return li.appendTo( ul );
},

_move: function( key, event ) {
@@ -364,8 +368,10 @@ $.widget( "ui.selectmenu", {
this.newelement.button( "option", "disabled", value );
if ( value ) {
this.element.attr( "disabled", "disabled" );
this.newelement.attr( "tabindex", -1 );
} else {
this.element.removeAttr( "disabled" );
this.newelement.attr( "tabindex", 1 );
}
this.list.attr( "aria-disabled", value );
this.close();

0 comments on commit a438ec3

Please sign in to comment.
You can’t perform that action at this time.