cm-chessboard
cm-chessboard copied to clipboard
fix promotion on mobile (Chrome) in the case that touchstart events get preventDefaulted
the mousedown event doesn't get emitted on mobile, making it impossible to promote, so use pointerdown instead
Is this a guess or really tested? I ask, because this script runs on my chess server chessmail.de and is used daily by 3000 users on all devices. https://www.chessmail.de/pages/chess-computer.html
Can you please give me more details on which phone, browser and OS it does not work.
It was tested in my own project, though I assumed the issue was more widespread than it really was.
It seems that this change is only needed for projects where .preventDefault() gets called on touchstart events (which is the case for my project) as it seems that on Chrome (I'm not sure about other browsers), the mousedown event doesn't get fired if the touchstart event got preventDefaulted.
Yes, now it makes sense. Right, if you use .preventDefault(), the mobile browser will not convert the mousedown into an additional touchstart and we can solve this by using pointerdown. I'll check if your pull request works for me and merge it if it does.