Open lesliana opened 8 years ago
@azakus I would like the propose that if the problem is, "more than one tap event can be generated for any given set of related pointer events," that this is a bug in Gestures. Could you provide some thoughts on that proposal?
Description
On a touch device, touching a paper-menu-button toggles the paper-menu to open, but then also incorrectly taps on whatever item within that menu is in the same position as the original button.
This appears to be because when the user touches the button, the touchstart+touchend events cause Polymer to fire a tap event, which is handled by paper-menu-button's 'toggle' handler function. The toggle function opens the paper-menu (if we're using the example dom in paper-menu-button.html, there is a child paper-menu with class dropdown-content). Meanwhile, the rest of the event chain from the touch continues firing in that same spot on the screen, and the mousedown, mouseup, and click events are handled by whatever child of the paper-menu is in the same spot on the screen as the original touch event. I think that when the paper-menu-button handles the first tap (with the toggle function), it should also preventDefault to stop the rest of the event chain from firing (note that preventDefault doesn't work in a tap handler until https://github.com/Polymer/polymer/issues/3567 is solved).
Expected outcome
A tap on the button opens the menu, and the menu stays open.
Actual outcome
A tap on the button opens the menu and immediately chooses one item from the menu and then closes the menu, without allowing the user to interact with the menu.
Live Demo
Having a lot of trouble getting jsbin to display a paper-menu-button - sometimes it'll work, then I'll edit one line (without changing anything about the imports) and it won't work anymore (I see this error, indicating the paper-menu-button resource hasn't been found: paper-menu-button.html:244 Uncaught TypeError: Cannot read property 'ANIMATION_CUBIC_BEZIER' of undefined)
Steps to reproduce