Skip to content

Bug: should not be able to copy empty string #7862

@dounan-sierra

Description

@dounan-sierra

Lexical version: v0.33.1 (but should also exist in latest 0.35)

Steps To Reproduce

  1. Put cursor into a text field but don't select anything
  2. Trigger a copy (i.e. cmd+c on mac)

The current behavior

An empty string is copied into the clipboard

The expected behavior

Clipboard is not updated. Should not be able to copy "nothing".

Offending code is likely here:

if (selection === null) {

It only checks if selection is null, but it should also check if the selection is "empty" (i.e. isCollapsed)

Image

Impact of fix

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions