Bug 12133 - Form buttons don't receive click events if the mouse is dragged before releasing
Summary: Form buttons don't receive click events if the mouse is dragged before releasing
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 420+
Hardware: PC Windows XP
: P2 Normal
Assignee: Nobody
URL: http://google.com
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-05 14:22 PST by Dex Deacon
Modified: 2007-01-26 09:39 PST (History)
2 users (show)

See Also:


Attachments
simple fix (1.35 KB, patch)
2007-01-05 15:53 PST, Dex Deacon
darin: review+
Details | Formatted Diff | Diff
alternate fix, matches firefox (1017 bytes, patch)
2007-01-19 18:07 PST, Dex Deacon
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dex Deacon 2007-01-05 14:22:14 PST
(Windows only, probably because Mac uses native widgets)

1. Visit any page with a form submission button (such as google.com).
2. Press the left mouse button on the form button, but don't release.
3. Move the mouse a small amount, keeping the cursor within the button.
4. Release the button.

If the mouse moved at all before you release, the form button will not be clicked.

This happens because invalidateClick() is called in EventHandler::handleMouseMoveEvent(), which resets the click count and prevents further mouse-up events from dispatching a click.  I don't think simply removing that call is the right move, though.
Comment 1 Dave Hyatt 2007-01-05 14:25:35 PST
ToT Mac does not use native widgets.
Comment 2 Dex Deacon 2007-01-05 15:53:11 PST
Created attachment 12250 [details]
simple fix

The click should only be invalidated if the move starts a selection - otherwise, it makes more sense to allow mouse movements during clicks.
Comment 3 Alexey Proskuryakov 2007-01-06 02:33:21 PST
It would be good to know why this doesn't happen on Mac.

See also: bug 8150.
Comment 4 Darin Adler 2007-01-06 16:57:20 PST
Comment on attachment 12250 [details]
simple fix

r=me
Comment 5 Dex Deacon 2007-01-08 13:41:35 PST
Oops - this bug is a dupe of http://bugs.webkit.org/show_bug.cgi?id=8150 .

My "simple fix" patch fixes the first two cases in that bug's attached test case (http://bugs.webkit.org/attachment.cgi?id=7480).  The third case still results in no click if the mouse is moved.

If you test the third case in Firefox, you'll see that a click is registered if and only if nothing is selected as a result of a drag - as soon as text is selected, the click is invalidated.  In IE7, the click is never invalidated - as long as the mouseup is in the same element as the mousedown, it's a click.  Not sure which behavior we'd prefer.
Comment 6 Dex Deacon 2007-01-08 13:58:47 PST
Simply removing the called to invalidateClick() altogether gives us behavior identical to Firefox.
Comment 7 Mark Rowe (bdash) 2007-01-18 17:38:59 PST
Should this patch be landed as-is, or do you intend to update it so that we match Firefox?
Comment 8 Dex Deacon 2007-01-19 18:07:06 PST
Created attachment 12565 [details]
alternate fix, matches firefox

I would prefer if we matched Firefox's behavior.  It seems more correct to me.
Comment 9 Darin Adler 2007-01-19 19:15:12 PST
Comment on attachment 12565 [details]
alternate fix, matches firefox

OK, sounds fine.
Comment 10 Darin Adler 2007-01-26 09:39:24 PST
I'm being sloppy here, not following our usual process and landing this change without an automated test. Next time I really need to do "review-" on a patch that fixes a bug that does not include a regression test for the fix.

Committed revision 19158.