79793438

Date: 2025-10-17 21:33:22
Score: 0.5
Natty:
Report link

🧩 Why Safari needs double tap on links (and the simple fix)

In iOS Safari, tapping a link sometimes requires two taps — the first activates the :hover state, and the second actually follows the link.
This happens because Safari doesn’t initialize touch events until a touchstart listener exists on the page.

You can fix it globally with a single line of JavaScript:

document.addEventListener('touchstart', () => {}, { passive: true });

This tells Safari:

“This page handles touch events — treat taps as immediate clicks.”

After adding this, links and buttons respond instantly with a single tap, while the { passive: true } option ensures it won’t block scrolling or cause performance issues.


Safe to use: yes, it’s a no-op listener.
📱 Affects: only iOS Safari (WebKit).
💡 Why it works: it forces Safari to initialize its touch event system early, avoiding the hover-delay behavior.

Reasons:
  • Blacklisted phrase (0.5): i need
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Flart