mobile - Why/when do I have to tap twice to trigger click on iOS -


ok feel i'm crazy...

i'm looking @ mobile safari on ios 6.0. can't seem establish rhyme or reason when tapping on element trigger click. in many cases, seems need tap once trigger hover , again trigger click.

the mobile safari spec says : "... flow of events generated one-finger , two-finger gestures conditional depending on whether or not selected element clickable or scrollable... clickable element link, form element, image map area, or other element mousemove, mousedown, mouseup, or onclick handlers... because of these differences, might need change of elements clickable elements..."

it goes on suggest developer "...add dummy onclick handler, onclick = "void(0)", safari on ios recognizes span element clickable element."

however, testing has shown these statements false.

jsfiddle : http://jsfiddle.net/6ymcy/1/

html

<div id="plain-div" onclick="void(0)">plain div</div> 

js

document.getelementbyid('plain-div').addeventlistener('click', function() {    alert('click');  }); 

try tapping element on ipad. nothing happens

but digress. important me find out following question:

exactly criteria determine when clicking on element fire 'click' event on first tap? opposed firing 'hover' event on first tap , 'click' event on second tap.

in testing, anchor elements elements can fire click on first tap, , then, , inconsistently.

here's start feel crazy. searched internet far , wide , found next nothing issue. me?! know there's been discussion criteria two-taps , or approach dealing these limitations?

i'm happy respond questions/requests.

thanks!

i had same issue. simplest solution not bind 'mouseenter' event on ios (or touch enabled target platform). if not bound hover event won't triggered , click triggered on first tap.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -