Skip to content
Permalink
Browse files

Button: Let change handler handle display and aria update. Fixed #551…

…8 - Button: Incorrect state after double click in Firefox
  • Loading branch information...
UltCombo authored and mikesherov committed Nov 27, 2012
1 parent 0cc8197 commit caacf8f5041ad434b8e0dd1069936eb91e4c3394
Showing with 12 additions and 2 deletions.
  1. +1 −0 tests/unit/button/button.html
  2. +11 −0 tests/unit/button/button_events.js
  3. +0 −2 ui/jquery.ui.button.js
@@ -68,6 +68,7 @@ <h2 id="qunit-userAgent"></h2>
</form>

<input type="checkbox" id="check"><label for="check">Toggle</label>
<input type="checkbox" id="check2"><label for="check2">Checkbox</label>

<div><input id="submit" type="submit" value="Label"></div>

@@ -23,4 +23,15 @@ test( "when button loses focus, ensure active state is removed (#8559)", functio
}).focus().simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } ).simulate( "keypress", { keyCode: $.ui.keyCode.ENTER } );
});

test( "ensure checked and aria after single click on checkbox label button", function() {
expect( 3 );

$("#check2").button().change( function() {
var lbl = $( this ).button("widget");
ok( this.checked, "checked ok" );
ok( lbl.attr("aria-pressed") === "true", "aria ok" );
ok( lbl.hasClass("ui-state-active"), "ui-state-active ok" );
}).button("widget").simulate("click");
});

})(jQuery);
@@ -147,8 +147,6 @@ $.widget( "ui.button", {
if ( options.disabled || clickDragged ) {
return false;
}
$( this ).toggleClass( "ui-state-active" );
that.buttonElement.attr( "aria-pressed", that.element[0].checked );
});
} else if ( this.type === "radio" ) {
this.buttonElement.bind( "click" + this.eventNamespace, function() {

0 comments on commit caacf8f

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