Multiple Click Events using Chrome and Firefox

7174
10
Jump to solution
08-22-2013 11:44 AM
JeffMitzelfelt
New Contributor III
I'm having a bit of an issue with multiple click events returning on a single mouse click and single click events returning after a pan or double click in Chrome and Firefox.

I have a jsFiddle set up that shows this. I am logging the click events to the console so you will need to open developer tools to see the clicks.

Here is the javascript I am using:
var map; var clickCount = 0; require([     "esri/map",     "dojo/domReady!"],  function (Map) {     map = new Map("divMap", {         basemap: "topo",         center: [-89.5, 40],         zoom: 6     });     map.on("click", function(evt){         console.log("Clicked" + (++clickCount));     }); });


I'm using the 3.6 API.

Any suggestions for a fix?

Thanks,
0 Kudos
1 Solution

Accepted Solutions
JeffMitzelfelt
New Contributor III
Well it appears my machine is to blame. After testing on a couple of other systems the problem did not show up. I will attempt to diagnose what the issue may be but until someone else sees this problem it appears to be an isolated incident.

Thanks for the feed back.

View solution in original post

0 Kudos
10 Replies
BenFousek
Occasional Contributor III
Jeff,
Are you saying click events fire when panning and double clicking in your fiddle?

I only get a click count on single clicks in FF and Chrome.
0 Kudos
JasonZou
Occasional Contributor III
I could not reproduce the issue using FireFox or Chrome either. Your code posted looks good to me. If more than one client event triggered by a single click, more than likely, you have defined the same event handler multiple times like in a loop. Check your code making sure an event handler only defined once.
0 Kudos
VinayBansal
Occasional Contributor II
Hi Jeff,
Even I could not reproduce the issue using FireFox or Chrome either. You might have defined the click event multiple times in your code. May be you have defined the click event of map in some other functionalities also, like....Identify or any other and they are increasing the count of click.
0 Kudos
JeffMitzelfelt
New Contributor III
I still get extra click event logging when I use the jsfiddle on Firefox and Chrome.

I'm running 64-bit Win7 with Firefox 22.0 and Chrome Version 28.0.1500.95 m

Still questing.  I'll try the fiddle on some other machines and see if there are differences.

Thanks for looking and reporting back!
0 Kudos
KenBuja
MVP Esteemed Contributor
I'm not getting the extra click event on IE 9.0.8112.16421, Chrome 29.1.1547.57, or Firefox 17.0.8 on Windows 7 Enterprise, Service Pack 1 with your new fiddle
0 Kudos
JeffMitzelfelt
New Contributor III
Well it appears my machine is to blame. After testing on a couple of other systems the problem did not show up. I will attempt to diagnose what the issue may be but until someone else sees this problem it appears to be an isolated incident.

Thanks for the feed back.
0 Kudos
BrianRassier
Occasional Contributor
Hi Jeff -

I am having a very similar issue where the click event is raised twice per actual mouse click.  Your jsfiddle reproduced the same issue for me too.  Did you ever find out what was to blame?  Or did you find a way to make a distinction between the 2 events to properly ignore one of them?

Thanks
-Brian
0 Kudos
EricWood2
New Contributor

I also started seeing this behavior over the last couple of weeks when using Chrome (41.0.2272.76).  The problem does not exist when I use IE (11.0.9600.17498).  It does appear to be related to my workstation though.  We tried it on another machine here at the office that is very similar and it did NOT exhibit the double events when using the same Chrome version.

0 Kudos
JeffMitzelfelt
New Contributor III

When I found that the issue was my machine. I didn't pursue the matter much further. I tested today and found that Chrome (40.0.2214.111 m) and Opera (27.0.1689.76) gave me extra click events, while FireFox(36.0.1) and Internet Explorer (11.0.9600.17633) didn't. The mystery lingers on.

0 Kudos