-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.click event fired twice on mobile devices [$20 awarded] #1976
Comments
Can you provide assets ? I didn't found event-1.1.5.js nowhere. When I tested that code it worked fine (Chrome Dev Tools with touch emulation):
EDIT: Ok, i found that in /lib folder. Tested with event-1.1.5.js script on Android (Chrome and stock 4.1.2 browsers) and that doesn't occur. Doesn't have iPhone to test it out. |
Running Chrome 40.0.2214.111 (64-bit) on Mac and .click is fired twice (when in device mode with iPhone 6/any mobile phone selected). It does not happen in device mode with "Generic notebook" selected. In device mode, "Emulate touch screen" and "Emulate mobile" are ticked (among others). Same results on Windows 8.1 and Chrome 40.0.2214.111 m. |
Weird, I have that setting enabled and don't have that issue. I've uploaded my test files here http://grimor.hmhost.pl/bountysource/fabricjs-test/ can you check if issue happens here ? |
Does not happen with the version/build of Fabric you're using. Yours say:
Ah, I think it's because gestures are excluded (in the version you're testing with). The one I'm using is:
|
Ok, I know what's the problem. It replace 'click' event to two events 'touchstart' and 'mousedown' and mobiles support both so it fires it both. The fastest way to 'fix' that is to comment (in fabric.js build):
and the uncomment line below
But I don't know if it won't make new problems (hopefuly not). I've got an idea how to fix it, but I'll do it later. PS. You don't have to include events-1.1.5.js it's bundled inside fabric.js |
There is also this in fabric.js i do know if you added this or not. It can be a timing of events. We have this
And maybe using this
Maybe in this way is fixed. A full testing is required on mobile device. |
Ok, I solved it. I will add PR soon. UPDATE: I've builded fabric.js from source using build script and it doesn't have that issue, even without my fix. Maybe that was fixed earlier. Although, I have that problem with custom build generated from the fabric.js website |
Yes, the bug seems to be fixed in the current source. Will use that from now on, thanks. Will award bounty. |
As soon as I realize how one awards bounties.. Issue can be closed, as it can't be found in the latest source. |
@grimor will claim the bounty, you will accept. i close the issue |
When fabric is included on mobile devices (tested on iPhone 6 and Chrome Developer Tools (with device mode)), any .click event is triggered twice.
The following code will output once click count on desktop but two on mobile devices.
The $20 bounty on this issue has been claimed at Bountysource.
The text was updated successfully, but these errors were encountered: