Skip to content

readOnly mode still allows cut/paste in context menus #6418

@darahak

Description

@darahak

JSFiddle for repro (reproducible in Chrome, Firefox and Edge)

When a CodeMirror editor is configured as read-only and the user opens a context menu, they can still see the cut and paste options.
It can be misleading since clicking on these items will do nothing.

While inspecting the elements inside the CM editor, I noticed a hidden <textarea> nested under a classless <div> styled with overflow: hidden among other things, right under <div class="CodeMirror cm-s-default">.
If I add the readonly attribute to that <textarea>, the issue seems fixed but could this lead to unwanted side effects?

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