Skip to main content

Bug Tracker

Side navigation

#6853 closed bug (worksforme)

Opened July 30, 2010 10:26PM UTC

Closed October 03, 2010 04:11AM UTC

two click events fired on a single click

Reported by: kjvarga Owned by:
Priority: undecided Milestone: 1.4.3
Component: event Version: 1.4.2
Keywords: click event Cc:
Blocked by: Blocking:
Description

Clicking on links/elements fires two click events on a single click under certain circumstances.

I've reproduced the problem using ANCHOR elements and DIV elements and using LIVE handlers, as well as ONCLICK and $('selector').click(function() { ... }) binding.

The problem is not fixed by using event.stopImmediatePropagation() or event.preventDefault();

The problem appears to be related to window focus. To reproduce, open the test.html file in a browser. Now open FireBug in FF or Developer in Chrome. Open it in its own window and have it in the foreground in such a way that you can still see the clickable areas in the test file. Click on one of the test divs. The test page will get focus. Click again. Often you will see two clicks being recorded in the console when you should only see one.

The events are triggered within < 200 ms of each other and contain the same pageX and pageY, target etc.

If you don't see it immediately, keep bringing the developer/console window to the foreground and clicking directly onto one of the test divs. After < 20 tries you should see the problem.

Reproduced on:

  • Mac OS X 10.6.4
  • jQuery 1.4.2
  • Safari 5.0.1 (6533.17.8)
  • Chrome 6.0.472.11 dev
  • Firefox 3.6.8
Attachments (1)
  • test.html (1.3 KB) - added by kjvarga July 30, 2010 10:26PM UTC.

test click events

Change History (1)

Changed October 03, 2010 04:11AM UTC by addyosmani comment:1

need: ReviewTest Case
priority: → undecided
resolution: → worksforme
status: newclosed

I tried running your test using the exact same conditions as mentioned in your ticket but was still only able to get one console log per click (this included multiple tests of the same process).

Could you re-submit the ticket with an additional test case?