lichess-org / chessground

Mobile/Web chess UI for lichess.org
https://lichess.org
GNU General Public License v3.0
1.04k stars 261 forks source link

fix duplicate select events on touch (#257) #268

Closed niklasf closed 1 year ago

niklasf commented 1 year ago

This is code always scary to ... touch, but here we go ...

start() is registered for both touchstart and mousedown. On touch devices, an unhandled (as in !e.defaultPrevented) touch event will generate a corresponding mousedown. So a lot of the start() handler runs twice on touch devices. It only works because:

With this patch: