diff options
author | Felix Nagel <info@felixnagel.com> | 2011-09-29 00:11:18 +0200 |
---|---|---|
committer | Felix Nagel <info@felixnagel.com> | 2011-09-29 00:11:18 +0200 |
commit | a438ec3b7d54f5b557208c2af4240d1daca06f5d (patch) | |
tree | 863285e8410372c192e2506cd767ff6a41acbaca | |
parent | c0ea81a2a82ca446f8b84c0e7c0df73fbd00a3f9 (diff) | |
download | jquery-ui-a438ec3b7d54f5b557208c2af4240d1daca06f5d.tar.gz jquery-ui-a438ec3b7d54f5b557208c2af4240d1daca06f5d.zip |
Selectmenu: fixed disabled status of the widget (keyboard control)
-rw-r--r-- | themes/base/jquery.ui.selectmenu.css | 4 | ||||
-rw-r--r-- | ui/jquery.ui.selectmenu.js | 16 |
2 files changed, 13 insertions, 7 deletions
diff --git a/themes/base/jquery.ui.selectmenu.css b/themes/base/jquery.ui.selectmenu.css index 95b1cf127..019273672 100644 --- a/themes/base/jquery.ui.selectmenu.css +++ b/themes/base/jquery.ui.selectmenu.css @@ -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; } diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index e7c04e234..edf3df1be 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -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(); |