mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Button: Remove obsolete mouse click coordinates checking. Fixed #7665 - Button: Radio button & checkboxes ignore mouseclicks for minor mouse movements.
(cherry picked from commit 8b64322e98
)
This commit is contained in:
parent
d21e8a6964
commit
52e0f768f5
29
ui/jquery.ui.button.js
vendored
29
ui/jquery.ui.button.js
vendored
@ -14,7 +14,7 @@
|
||||
*/
|
||||
(function( $, undefined ) {
|
||||
|
||||
var lastActive, startXPos, startYPos, clickDragged,
|
||||
var lastActive,
|
||||
baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
|
||||
typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",
|
||||
formResetHandler = function() {
|
||||
@ -115,42 +115,19 @@ $.widget( "ui.button", {
|
||||
|
||||
if ( toggleButton ) {
|
||||
this.element.bind( "change" + this.eventNamespace, function() {
|
||||
if ( clickDragged ) {
|
||||
return;
|
||||
}
|
||||
that.refresh();
|
||||
});
|
||||
// if mouse moves between mousedown and mouseup (drag) set clickDragged flag
|
||||
// prevents issue where button state changes but checkbox/radio checked state
|
||||
// does not in Firefox (see ticket #6970)
|
||||
this.buttonElement
|
||||
.bind( "mousedown" + this.eventNamespace, function( event ) {
|
||||
if ( options.disabled ) {
|
||||
return;
|
||||
}
|
||||
clickDragged = false;
|
||||
startXPos = event.pageX;
|
||||
startYPos = event.pageY;
|
||||
})
|
||||
.bind( "mouseup" + this.eventNamespace, function( event ) {
|
||||
if ( options.disabled ) {
|
||||
return;
|
||||
}
|
||||
if ( startXPos !== event.pageX || startYPos !== event.pageY ) {
|
||||
clickDragged = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if ( this.type === "checkbox" ) {
|
||||
this.buttonElement.bind( "click" + this.eventNamespace, function() {
|
||||
if ( options.disabled || clickDragged ) {
|
||||
if ( options.disabled ) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else if ( this.type === "radio" ) {
|
||||
this.buttonElement.bind( "click" + this.eventNamespace, function() {
|
||||
if ( options.disabled || clickDragged ) {
|
||||
if ( options.disabled ) {
|
||||
return false;
|
||||
}
|
||||
$( this ).addClass( "ui-state-active" );
|
||||
|
Loading…
Reference in New Issue
Block a user