-- Leo's gemini proxy

-- Connecting to republic.circumlunar.space:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

Mousedown events delayed or sluggish on mobile


I am learning about Elm and web apps by writing a little game called sootl.


It's all SVGs animated with requestAnimationFrame(), and you control your player by clicking or touch the screen.


Elm

sootl

requestAnimationFrame()


Everything seemed good on desktop browsers, but on mobile it took an age for the mousedown event to trigger when you touched.


Update: Thanks to @zatnosk on mastodon.social for letting me know there is a better way: 300ms tap delay, gone away. Short answer: add a <meta name="viewport" content="width=device-width"> tag inside your <head> tag.


It turns out that under certain circumstances, some mobile devices wait after the first touch happens to see whether you are going to swipe before they emit the mousedown event.


@zatnosk on mastodon.social

300ms tap delay, gone away

It turns out


So, the short answer was to listen for touchstart events as well as mousedown ones. In Elm that looked like this change: e77e055e470c38489657ecaf5edc54a4e5f85782.


Originally posted at 2016-09-30 19:47:22+00:00. Automatically generated from the original post : apologies for the errors introduced.


e77e055e470c38489657ecaf5edc54a4e5f85782

original post

-- Response ended

-- Page fetched on Sun May 19 07:56:30 2024