Bug Tracker

Opened 13 years ago

Closed 13 years ago

#6853 closed bug (worksforme)

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 13 years ago.
test click events

Download all attachments as: .zip

Change History (2)

Changed 13 years ago by kjvarga

Attachment: test.html added

test click events

comment:1 Changed 13 years ago by addyosmani

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?

Note: See TracTickets for help on using tickets.