Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When to use on-click or on-tap w/ Polymer?

I've researched a lot but still haven't found a good answer. When should I use on-click and when on-tap, specifically w/ Polymer?

This guide focuses on programmatic event listeners, so isn't helpful in that regard:

https://www.polymer-project.org/docs/polymer/touch.html

like image 235
David Notik Avatar asked Oct 15 '14 15:10

David Notik


3 Answers

Use on-tap all the time, because the semantics of on-tap are better aligned with mobile devices than on-click.

For example, on-click does not fire if another finger is touching the screen, or if the element directly under the finger does not have a mouse handler. There are also some complications with getting on-click to work while you are scrolling. Use on-tap unless there is a compelling reason not to.

like image 168
Shailen Tuli Avatar answered Nov 18 '22 13:11

Shailen Tuli


You should not use the legacy on-tap anymore since this is deprecated in Polymer 2 and 3. See https://polymer-library.polymer-project.org/3.0/docs/devguide/gesture-events

like image 23
schlm3 Avatar answered Nov 18 '22 14:11

schlm3


In Polymer 2 documentation and Polymer 3 documentation, using on-click event is suggested. on-tap is legacy.

like image 1
burak Avatar answered Nov 18 '22 12:11

burak