Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/unit/button/button.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
12 changes: 12 additions & 0 deletions tests/unit/button/button_events.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,16 @@ 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);
26 changes: 26 additions & 0 deletions tests/visual/button/tickets.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Button Visual Test: Tickets</title>
<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
<script src="../../../jquery-1.8.3.js"></script>
<script src="../../../ui/jquery.ui.core.js"></script>
<script src="../../../ui/jquery.ui.widget.js"></script>
<script src="../../../ui/jquery.ui.button.js"></script>
<script>
$(function() {
$( "#t5518ch" ).button().on( "click change", function() {
$( "#t5518checked" ).text( this.checked );
$( "#t5518aria" ).text( $( this ).button( "widget" ).attr( "aria-pressed" ) );
}).change();
});
</script>
</head>
<body>
<h1>#5518 - Incorrect state after double click in Firefox</h1>
<input type="checkbox" id="t5518ch"><label for="t5518ch">Double click this button and check if its checked and aria state correspond to the current display</label>
<p>Checked state: <span id="t5518checked"></span></p>
<p>Aria state: <span id="t5518aria"></span></p>
</body>
</html>
1 change: 1 addition & 0 deletions tests/visual/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ <h2>Button</h2>
<ul>
<li><a href="button/button.html">General</a></li>
<li><a href="button/performance.html">Performance</a></li>
<li><a href="button/tickets.html">Tickets</a></li>
</ul>

<h2>Dialog</h2>
Expand Down
5 changes: 3 additions & 2 deletions ui/jquery.ui.button.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,9 @@ $.widget( "ui.button", {
if ( options.disabled || clickDragged ) {
return false;
}
$( this ).toggleClass( "ui-state-active" );
that.buttonElement.attr( "aria-pressed", that.element[0].checked );
// Fix #5518 - let change handler handle display and aria update
//$( 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() {
Expand Down