FIX: distinguish between scroll and drag for sidebar (#22794)

Change to drag move event handling. When position of mouse changed, we can assume it is not drag and drop, and we should keep default behaviour.

Otherwise, we stop propagation of the event to handle drag and drop correctly. s
This commit is contained in:
Krzysztof Kotlarek 2023-07-26 11:56:54 +10:00 committed by GitHub
parent 44a104dff8
commit 6e3da7c07d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 3 deletions

View File

@ -82,10 +82,24 @@ export default class SectionLink {
@bind
dragMove(event) {
this.startMouseY = this.#calcMouseY(event);
const moveMouseY = this.#calcMouseY(event);
event.stopPropagation();
event.preventDefault();
if (this.willDrag && moveMouseY !== this.startMouseY && !this.drag) {
/**
* If mouse position is different, it means that it is a scroll and not drag and drop action.
* In that case, we want to do nothing and keep original behaviour.
*/
this.willDrag = false;
return;
} else {
/**
* Otherwise, event propagation should be stopped as we have our own handler for drag and drop.
*/
event.stopPropagation();
event.preventDefault();
}
this.startMouseY = moveMouseY;
if (!this.drag) {
return;