Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

PointerEvents not initializing properly for SVG elements with 0.2.0+ #134

Closed
bergie opened this issue Mar 8, 2014 · 10 comments
Closed

PointerEvents not initializing properly for SVG elements with 0.2.0+ #134

bergie opened this issue Mar 8, 2014 · 10 comments

Comments

@bergie
Copy link

bergie commented Mar 8, 2014

It seems PointerEvents are badly broken in 0.2.1. When I load noflo-ui with the new Polymer & platform release, none of the pointer events or gestures are working.

Now, in JavaScript console I do:

document.addEventListener('pointerdown', function (event) { console.log('pointerdown', event.target); });
document.addEventListener('trackstart', function (event) { console.log('trackstart', event.target); });

I try dragging in the graph editor, and nothing happens. No console output.

However, once I add this:

document.addEventListener('touchstart', function (event) { console.log('touchstart', event.target); });

everything starts working properly.

screenshot 2014-03-08 at 16 10 32

@bergie
Copy link
Author

bergie commented Mar 8, 2014

I'm assuming it comes from some subtle timing issue related to this commit:

screenshot 2014-03-08 at 16 26 08

DOMContentLoaded, which was used in earlier PointerEvents fires earlier than readystatechange complete.

@bergie
Copy link
Author

bergie commented Mar 8, 2014

Might have to do with React doing its own work at DOMContentLoaded

bergie added a commit to flowhub/the-card that referenced this issue Mar 8, 2014
bergie added a commit to flowhub/the-panel that referenced this issue Mar 8, 2014
bergie added a commit to flowhub/the-graph that referenced this issue Mar 8, 2014
@bergie
Copy link
Author

bergie commented Mar 8, 2014

Update: seems due to Polymer/polymer#440 we had been using Polymer 0.2.0 with Platform 0.1.4. This bug has appeared between 0.1.4 and 0.2.0

@bergie
Copy link
Author

bergie commented Mar 8, 2014

I'm starting to be convinced that the issue is with fdf80d6 (#124)

Confirmed: this bug only happens with SVG.

bergie added a commit to noflo/noflo-ui that referenced this issue Mar 8, 2014
bergie added a commit to noflo/noflo-ui that referenced this issue Mar 8, 2014
@dfreedm
Copy link
Contributor

dfreedm commented Mar 8, 2014

The real issue is Polymer/ShadowDOM#394

@dfreedm
Copy link
Contributor

dfreedm commented Aug 12, 2014

I think this is actually a safari bug, which I used the same workaround for in googlearchive/polymer-gestures#33

@dfreedm dfreedm closed this as completed Aug 12, 2014
@dfreedm
Copy link
Contributor

dfreedm commented Aug 14, 2014

Reopening for future interested parties.

@msegado
Copy link

msegado commented Jul 6, 2015

@azakus / @scottgonzalez, would including the Safari bug workaround described at googlearchive/polymer-gestures#33 be within the scope of the pep.js project? I could probably help with a PR if so...

Possible approaches:

  1. Always add the fix on iOS Safari until https://bugs.webkit.org/show_bug.cgi?id=135628 is resolved
  2. Only add the fix when SVG elements are detected (if always having an extra touchstart on document.body is undesirable)
  3. Just wait until it's fixed in Safari and add a note to the Readme =)

@msegado
Copy link

msegado commented Jul 26, 2015

A quick update for anyone experiencing the same issue: it looks like events are correctly dispatched when touching elements within the SVG, just not the SVG element itself. Adding a transparent rectangle with 100% width and height allows touches to generate events which bubble up and can then be caught on the SVG.

@patrickhlauke
Copy link
Collaborator

PEP has now entered emeritus status at the OpenJS Foundation. This repository is now archived.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants