googlearchive / paper-menu

A Material Design menu
https://www.webcomponents.org/element/PolymerElements/paper-menu
27 stars 48 forks source link

Cannot select when item is distributed into shadow DOM #82

Closed tpluscode closed 8 years ago

tpluscode commented 8 years ago

Hi. I'm not sure whether this an issue of <paper-menu> or <paper-item>, so sorry if I'm raising this in the wrong repository.

In this plunk demonstrate how it's not possible to select a <paper-item>, when it's content is distributed into the Shadow DOM. Clicking a distributed <span> does nothing. It is still possible to select an item by clicking around it, though.

This problem does not occur with Shady DOM (when you comment out the top script).

tpluscode commented 8 years ago

I see that this is similar to #21 but I don't think it's the same issue, is it?

notwaldorf commented 8 years ago

In your plunkr, clicking selects the items fine (but it's using an older version of paper-item which has a selection quirk), so here it is as a jsbin, with all the latest releases of the elements: http://jsbin.com/rucude/edit?html,output

Closing, as this is no longer an issue.

tpluscode commented 8 years ago

Unfortunately your sample doesn't work either. Sure it selects fine when you click the item but does not select when you click the distributed label.

I tweaked my plunk so that it's clear, where to click :wink:

notwaldorf commented 8 years ago

Ok. @cdata found a workaround, which is to set pointer-events:none to your distributed paper-item content. Here's the updated plunkr to demo that: https://plnkr.co/edit/gsQrm5iClsejvjCkGhwc?p=preview

This is a bit of a scary change to add to paper-item itself, since we have no guarantee it won't break other people (my experience with paper-item is that everybody uses it in ways I haven't thought about), and this is a bit of an edge case to begin with.

Anyway, this should fix your issue.

tpluscode commented 8 years ago

Nice workaround. Thank you

notwaldorf commented 8 years ago

Glad this worked out!