windows chrome with touch + mouse triggering move on right-click
markvp opened this issue · 0 comments
On a windows device with the latest google chrome browser, a right click on an element with the item-handle element brings up the context menu (to, for example, save a url or open in new tab), however upon closing the context menu, the move has been triggered.
The cause of this is line 167 in sortable-item-handle.js
if (!hasTouch && (event.button === 2 || event.which === 3)) {
// disable right click
return;
}
I have explored firefox, safari, IE 11, Edge and chrome and can find no need for the !hasTouch
restriction. Touch based context menu initiation does not set event.button === 2
or event.which === 3
so the !hasTouch
check is superfluous and causing this error in combined mouse + touch environments.
Interestingly, neither firefox, safari, IE 11 nor Edge trigger the event in the mouse + touch environment, only chrome. So it is possible that this is caused by an erroneous event trigger in chrome; however given the unnecessary exclusion of touch devices I request that we remove the !hasTouch
check from this code.
The resulting code would be:
if (event.button === 2 || event.which === 3) {
// disable right click
return;
}
For such a simple change, I didn't feel that a pull-request was necessary (I didn't want to go through the overhead of creating a repository, forking, etc).
Thanks!
Mark