Skip to content

Placeholder does not allow paste from context menu #1542

@lucharlesc

Description

@lucharlesc

Describe the issue

Text from the placeholder extension does not allow paste from the context menu on Chrome and Firefox. Safari does not appear to have this issue. Fix is possible by adding userSelect: "none" style to .cm-placeholder class via theme, but maybe this should be included by default by the extension in addition to the pointerEvents: "none" style here: https://github.com/codemirror/view/blob/main/src/placeholder.ts#L13.

Chrome

Context menu with "Paste" unavailable when right clicking on placeholder:
Image

Context menu with "Paste" available when right clicking off placeholder:
Image

Firefox

Context menu with "Paste" unavailable when right clicking on placeholder:
Image

Context menu with "Paste" available when right clicking off placeholder:
Image

Browser and platform

Chrome 134.0.6998.44, Firefox 136.0.3, macOS 15.2

Reproduction link

https://codemirror.net/try/#c=aW1wb3J0IHttaW5pbWFsU2V0dXAsIEVkaXRvclZpZXd9IGZyb20gImNvZGVtaXJyb3IiCmltcG9ydCB7cGxhY2Vob2xkZXJ9IGZyb20gIkBjb2RlbWlycm9yL3ZpZXciCgpuZXcgRWRpdG9yVmlldyh7CiAgZXh0ZW5zaW9uczogbWluaW1hbFNldHVwLmNvbmNhdChbCiAgICBwbGFjZWhvbGRlcigiUGxhY2Vob2xkZXIiKSwKICAgIEVkaXRvclZpZXcudGhlbWUoewogICAgICAiLmNtLXBsYWNlaG9sZGVyIjogewogICAgICAgIC8vIHVzZXJTZWxlY3Q6ICJub25lIiAvLyBVbmNvbW1lbnQgdGhpcyBsaW5lIHRvIGZpeCBvbiBDaHJvbWUgYW5kIEZpcmVmb3gKICAgICAgfQogICAgfSkKICBdKSwKICBwYXJlbnQ6IGRvY3VtZW50LmJvZHkKfSkK

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