mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Button: Don't react to keydown when disabled.
Partial fix for #5328 - button disabled only visually when disabled option set, still functional.
This commit is contained in:
parent
c75abc5e9a
commit
385269e3ea
8
ui/jquery.ui.button.js
vendored
8
ui/jquery.ui.button.js
vendored
@ -145,7 +145,10 @@ $.widget( "ui.button", {
|
||||
$( this ).removeClass( "ui-state-active" );
|
||||
})
|
||||
.bind( "keydown.button", function(event) {
|
||||
if ( event.keyCode === $.ui.keyCode.SPACE || event.keyCode === $.ui.keyCode.ENTER ) {
|
||||
if ( options.disabled ) {
|
||||
return;
|
||||
}
|
||||
if ( event.keyCode == $.ui.keyCode.SPACE || event.keyCode == $.ui.keyCode.ENTER ) {
|
||||
$( this ).addClass( "ui-state-active" );
|
||||
}
|
||||
})
|
||||
@ -166,8 +169,7 @@ $.widget( "ui.button", {
|
||||
// TODO: pull out $.Widget's handling for the disabled option into
|
||||
// $.Widget.prototype._setOptionDisabled so it's easy to proxy and can
|
||||
// be overridden by individual plugins
|
||||
$.Widget.prototype._setOption.call( this, "disabled", options.disabled );
|
||||
this._resetButton();
|
||||
this._setOption( "disabled", options.disabled );
|
||||
},
|
||||
|
||||
_determineButtonType: function() {
|
||||
|
Loading…
Reference in New Issue
Block a user