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

use drag and drop html api #97

Open isaacl opened 5 years ago

isaacl commented 5 years ago

Drag and Drop api is pretty well supported. It would allow dragged pieces to track more closely to mouse pointer, making for smoother piece movement.

https://caniuse.com/#search=draganddrop

cc @niklasf

ornicar commented 5 years ago

Pretty sure it's a bad idea, but feel free to try

isaacl commented 5 years ago

see also https://medium.com/backticks-tildes/drag-and-drop-with-html5-368a1bb72881 and the possibly obsolete https://www.useragentman.com/blog/2010/01/10/cross-browser-html5-drag-and-drop/ which supports IE

ghost commented 4 years ago

This doesn't work by the way if the Windows Classic theme is enabled, although it seems smoother with html api. Also it might be possible to check if the classic theme is enabled and fall back to the default dragging method: https://stackoverflow.com/questions/2450133/javascript-detect-if-xp-or-classic-windows-theme-is-enabled

niklasf commented 4 years ago

So whether or not native drag/drop will work, depends on multiple factors (not for Windows Classic, not for X11 (maybe only i3), ...) that are impossible(?) to detect. So it does not seem feasible for now, even as progressive enhancement.

LeoDog896 commented 1 year ago

@niklasf where did you get the info that it doesn't work for X11? It usually works for me quite fine. (Can't ping since ghost) but can someone else triage that? The only place I can find that drag and drop for Windows Classic doesn't work is this issue, surprisingly.

It'll require edge 18+, but other than that, it doesn't break much else from a glance in the caniuse website.

Name Version Notes
Chromium / Chrome last 10 Full support
Firefox 63+ Full support (fastest local analysis since FF 79)
Edge 91+ Full support (reasonable support for 1718+)
Opera 55+ Reasonable support
Safari 11.1+ Reasonable support
benediktwerner commented 1 year ago

Note that the previous comment is more than 3 years old.

LeoDog896 commented 1 year ago

Note that the previous comment is more than 3 years old.

I somehow acknowledged this and yet failed to realize that "hey maybe this implies they don't remember where they got it from". In that case, it seems that now there's not really much compatibility against the drag and drop API. It should be ready to use :+!:

niklasf commented 1 year ago

I do remember that I just tried some demo myself back then. Trying another random demo today, I don't see the same problem.

isaacl commented 1 year ago

there's some snippets here: https://github.com/lichess-org/chessground/compare/master...isaacl:chessground:dragDrop

of an attempt I tried a couple years ago. Even with full support, browsers centered the hover icon differently, and I was forced to use different behavior for different browsers. But I still recon it's doable.