Skip to content
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/tap selection not working when used in Polymer/shadow-dom #116

Closed
mpilone opened this issue Oct 1, 2019 · 3 comments
Closed

Click/tap selection not working when used in Polymer/shadow-dom #116

mpilone opened this issue Oct 1, 2019 · 3 comments
Labels
question Further information is requested

Comments

@mpilone
Copy link
Contributor

mpilone commented Oct 1, 2019

I ran into this issue a long while back while working with VisJs Timeline. At the time I was able to work around the issue by modifying Hammer to generate an event with a different target but I'm not sure that is the right approach.

The root issue is that when you use Timeline in a Polymer element, single click selection doesn't work while long press selection does. It looks like the target element in the event is different for the events generated by Hammer but I don't understand why. I originally thought this was a Hammer issue, but after creating a test case and a bug with that project, it appears that it is behaving correctly.

When I debug the Timeline, I get a call to _onSelectItem in ItemSet.js but the event target is "vis-timeline vis-bottom vis-ltr" while _onMultiSelectItem gets an event target of "vis-item-overflow".

I can't seem to figure out why the two targets are different given that they are being generated by the same Hammer instance created around line 280 this.hammer = new Hammer(this.body.dom.centerContainer);. I noticed that a tap event is also registered against the groupHammer a few lines later while a press is not so maybe that is involved somehow. Timeline is also using propagating-hammer so maybe that is also throwing something into the mix.

I'm testing with:

  • Firefox 69.0.1
  • Timeline 5.1.0 (although the same problem seems to exist in master)
  • MacOS 10.14.6

I attached a simple test case using the Polymer starter project. Just run npm install && polymer serve. The super simple example shows single click/tap not selecting while long click/press will select and item.

start-polymer3-timeline.zip

@mojoaxel mojoaxel added the question Further information is requested label Oct 1, 2019
@mpilone
Copy link
Contributor Author

mpilone commented Oct 28, 2019

I kept digging on this and it may be related to naver/hammer.js#21. If that is the root cause then this probably isn't a Timeline issue but a Hammer issue.

@yotamberk
Copy link
Member

Can you try playing around with the press and tap event registering and see if this really is the cause?

@mpilone
Copy link
Contributor Author

mpilone commented Nov 11, 2019

I confirmed that this was an issue with Hammer when used in shadow-dom. I tested the fix to naver/hammer.js#21 in version 2.0.16 with the latest timeline master and it resolves the issue.

I'm going to close this ticket but Timeline needs to update to "@egjs/hammerjs": "2.0.16" to include the fix. Would it be possible to get that version bumped in a future release? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants