Skip to content
Permalink
Browse files

button: add ui-state-focus on focus, making keyboard navigation possi…

…ble, and button like 200% more accessible
  • Loading branch information
jzaefferer committed Jan 20, 2010
1 parent d01e785 commit dab6e943b3dc8ee7c9832ef7d06daf45ec39c4b0
Showing with 9 additions and 1 deletion.
  1. +9 −1 ui/jquery.ui.button.js
@@ -34,7 +34,8 @@ $.widget( "ui.button", {
var self = this,
options = this.options,
toggleButton = this.type === "checkbox" || this.type === "radio",
hoverClass = "ui-state-hover" + ( !toggleButton ? " ui-state-active" : "" );
hoverClass = "ui-state-hover" + ( !toggleButton ? " ui-state-active" : "" ),
focusClass = "ui-state-focus";

if ( options.label === null ) {
options.label = this.buttonElement.html();
@@ -57,6 +58,13 @@ $.widget( "ui.button", {
return;
}
$( this ).removeClass( hoverClass );
})
.bind( "focus.button", function() {
// no need to check disabled, focus won't be triggered anyway
$( this ).addClass( focusClass );
})
.bind( "blur.button", function() {
$( this ).removeClass( focusClass );
});

if ( this.type === "checkbox") {

0 comments on commit dab6e94

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