I have a tooltip which uses 2 event listeners: mouseenter
(to open it) and mouseleave
(to close it).
In desktop browsers and iPhone iOS 13.2 it works fine, however it wasn't closing for iPhone iOS 12.2.
I found a solution, setting the CSS cursor: pointer;
on the background element. So it would seem iOS needs a bit of help detecting the mouseleave
event.
Is there another solution? Settings cursor: pointer;
feels hacky and could be confusing in some circumstances.
UPDATE: I added the following code to simplify my test and as I expected 'testing' is logged when I tap the screen for iOS13 but not iOS12. However when I put that code (and nothing else) into codepen.io and view it that way then both versions work fine.
function doTest() {
console.log('testing');
}
document.addEventListener('click', doTest);