Skip to content

Commit 8b64322

Browse files
Fabrício Mattéscottgonzalez
Fabrício Matté
authored andcommitted
Button: Remove obsolete mouse click coordinates checking. Fixed #7665 - Button: Radio button & checkboxes ignore mouseclicks for minor mouse movements.
1 parent f16d0c7 commit 8b64322

File tree

1 file changed

+3
-26
lines changed

1 file changed

+3
-26
lines changed

ui/jquery.ui.button.js

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
(function( $, undefined ) {
1616

17-
var lastActive, startXPos, startYPos, clickDragged,
17+
var lastActive,
1818
baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
1919
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",
2020
formResetHandler = function() {
@@ -115,42 +115,19 @@ $.widget( "ui.button", {
115115

116116
if ( toggleButton ) {
117117
this.element.bind( "change" + this.eventNamespace, function() {
118-
if ( clickDragged ) {
119-
return;
120-
}
121118
that.refresh();
122119
});
123-
// if mouse moves between mousedown and mouseup (drag) set clickDragged flag
124-
// prevents issue where button state changes but checkbox/radio checked state
125-
// does not in Firefox (see ticket #6970)
126-
this.buttonElement
127-
.bind( "mousedown" + this.eventNamespace, function( event ) {
128-
if ( options.disabled ) {
129-
return;
130-
}
131-
clickDragged = false;
132-
startXPos = event.pageX;
133-
startYPos = event.pageY;
134-
})
135-
.bind( "mouseup" + this.eventNamespace, function( event ) {
136-
if ( options.disabled ) {
137-
return;
138-
}
139-
if ( startXPos !== event.pageX || startYPos !== event.pageY ) {
140-
clickDragged = true;
141-
}
142-
});
143120
}
144121

145122
if ( this.type === "checkbox" ) {
146123
this.buttonElement.bind( "click" + this.eventNamespace, function() {
147-
if ( options.disabled || clickDragged ) {
124+
if ( options.disabled ) {
148125
return false;
149126
}
150127
});
151128
} else if ( this.type === "radio" ) {
152129
this.buttonElement.bind( "click" + this.eventNamespace, function() {
153-
if ( options.disabled || clickDragged ) {
130+
if ( options.disabled ) {
154131
return false;
155132
}
156133
$( this ).addClass( "ui-state-active" );

0 commit comments

Comments
 (0)