What happens in lichess is:
- You have a selected piece without having mouse pressed (either you selected via clicking it, or dragging and dropping on the same square)
 
- You can immediately start dragging it elsewhere
 
- If you drop it again on the square it now unselects it.
 
Currently we are doing -> if you have a selected piece (while not having anything pressed) -> as soon as you click it, it unselects it and doesn't let you start dragging it.