Skip to content
This repository was archived by the owner on Apr 16, 2026. It is now read-only.
This repository was archived by the owner on Apr 16, 2026. It is now read-only.

[v4] Setting selection while opening context menu causes deletion #2369

@njx

Description

@njx
  1. In demo/theme.html from v4, add this code to the end of the <script> at the bottom:
  editor.getWrapperElement().addEventListener("contextmenu", function () {
      editor.setSelection({line: 0, ch: 0}, {line: 1, ch: 0});
  });
  1. Open the file in the browser and right-click in the editor

Result: The first line is deleted. This doesn't happen if you handle the context menu from CodeMirror's own contextmenu event.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions