Skip to content

Escape key to cancel drag? #28

@srgreen00

Description

@srgreen00

Is it possible to cause the drag the cancel by hitting the escape key? While the HTML 5 backend will cancel the drag on escape, the mouse back end drag is not effected.

Though I donʻt see how that where that might have been implemented explicitly on HTML5, I was looking at the TouchBackend. It has a enableKeyboardEvents property.

When set, it adds a keyboard listener that calls the following on escape.

handleCancelOnEscape (e) {
    if (e.key === 'Escape' && this.monitor.isDragging()){
        this._mouseClientOffset = {};

        this.uninstallSourceNodeRemovalObserver();
        this.actions.endDrag();
    }
}

Would something like this be needed to handle escape in the mouse back end?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions