Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Selectmenu: improved disabled state handling

  • Loading branch information...
commit 762131396e8c993b1bef3d786bbd6cc34dfb4bce 1 parent 8c17f74
@fnagel fnagel authored
View
9 tests/unit/selectmenu/selectmenu_methods.js
@@ -33,21 +33,22 @@ test("enable / disable", function () {
var element = $("#speed").selectmenu();
var widget = element.selectmenu("widget");
var button = widget.filter(".ui-selectmenu-button");
+ var link = button.children("a");
var menu = widget.filter(".ui-selectmenu-menu");
element.selectmenu("disable")
ok( element.selectmenu("option", "disabled"), "disable: widget option" );
equals( button.attr("aria-disabled"), "true", "disable: button wrapper ARIA" );
- equals( button.children("a").attr("aria-disabled"), "true", "disable: button ARIA" );
- equals( button.children("a").attr("tabindex"), -1, "disable: button tabindex" );
+ equals( link.attr("aria-disabled"), "true", "disable: button ARIA" );
+ equals( link.attr("tabindex"), -1, "disable: button tabindex" );
equals( menu.attr("aria-disabled"), "true", "disable: menu wrapper ARIA" );
equals( menu.children("ul").attr("aria-disabled"), "true", "disable: menu ARIA" );
element.selectmenu("enable")
ok( !element.selectmenu("option", "disabled"), "enable: widget option" );
equals( button.attr("aria-disabled"), "false", "enable: button wrapper ARIA" );
- equals( button.children("a").attr("aria-disabled"), "false", "enable: button ARIA" );
- equals( button.children("a").attr("tabindex"), 0, "enable: button tabindex" );
+ equals( link.attr("aria-disabled"), "false", "enable: button ARIA" );
+ equals( link.attr("tabindex"), 0, "enable: button tabindex" );
equals( menu.attr("aria-disabled"), "false", "enable: menu wrapper ARIA" );
equals( menu.children("ul").attr("aria-disabled"), "false", "enable: menu ARIA" );
});
View
7 ui/jquery.ui.selectmenu.js
@@ -62,6 +62,10 @@ $.widget( "ui.selectmenu", {
this._bind( this.button, this._buttonEvents );
this._drawMenu();
+
+ if ( this.element.attr( 'disabled' ) ) {
+ this.disable();
+ }
},
_drawButton: function() {
@@ -78,7 +82,6 @@ $.widget( "ui.selectmenu", {
css: {
width: this.element.outerWidth()
},
- 'aria-disabled': this.options.disabled,
'aria-owns': this.ids.menu,
'aria-haspopup': true
})
@@ -391,6 +394,7 @@ $.widget( "ui.selectmenu", {
}
if ( key === "disabled" ) {
this.button.button( "option", "disabled", value );
+ this.menu.menu( "option", "disabled", value );
if ( value ) {
this.element.attr( "disabled", "disabled" );
this.button.attr( "tabindex", -1 );
@@ -399,7 +403,6 @@ $.widget( "ui.selectmenu", {
this.element.removeAttr( "disabled" );
this.button.attr( "tabindex", 0 );
}
- this.menu.attr( "aria-disabled", value );
}
},
Please sign in to comment.
Something went wrong with that request. Please try again.