mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-25 09:03:12 +03:00
Fixed card settings panel drag outside of central editor canvas closing panel
refs https://github.com/TryGhost/Team/issues/1208 - removing the click event listener in the same event loop as the `dragEnd` event is triggered meant Chrome still allowed the `click` event to trigger causing the card to become deselected and the movable panel closed when a drag ends outside of the central editor canvas - adding a 1ms timeout means the event loop where the dragEnd is triggered fully completes before the next tick begins where the click handler is finally removed
This commit is contained in:
parent
59fb902b1c
commit
1bf14c2cc3
@ -48,7 +48,13 @@ export default class MovableModifier extends Modifier {
|
||||
window.removeEventListener('touchmove', this.drag, {capture: true, passive: false});
|
||||
window.removeEventListener('mouseup', this.dragEnd, {capture: true, passive: false});
|
||||
window.removeEventListener('mousemove', this.drag, {capture: true, passive: false});
|
||||
window.removeEventListener('click', this.cancelClick, {capture: true, passive: false});
|
||||
|
||||
// Removing this immediately results in the click event behind re-enabled in the same
|
||||
// event loop meaning that it doesn't have the desired effect when dragging out of the canvas.
|
||||
// Putting in the next tick stops the immediate click event firing when finishing drag
|
||||
setTimeout(() => {
|
||||
window.removeEventListener('click', this.cancelClick, {capture: true, passive: false});
|
||||
}, 1);
|
||||
}
|
||||
|
||||
removeEventListeners() {
|
||||
|
Loading…
Reference in New Issue
Block a user