Skip to content

Copying a partial unmergable block has no visible effect (and copy fails) #54193

Open
@aaronjbaptiste

Description

Description

Follow up to #40098.

#40098 PR added the ability to select and copy/cut partial text from multiple blocks. However for unmergable blocks like the Quote block the fallback behaviour is set to only expand the selection. However this has two problems:

  1. Visually the selection already covers the full blocks - so the __unstableExpandSelection() call is not visible to the user, they do not see the selection change - so they would assume the copy succeeded.
  2. The copy failed. After the expansion nothing happens, I would assume it would expand and then copy the full blocks as to fill the clipboard with something.

Overall for the user, if they go to paste this content will find that the copy did not work. Usually this actually pastes old clipboard content (from a previous successful copy) or does nothing in the case of an empty clipboard.

Step-by-step reproduction instructions

  1. Go to https://wordpress.org/gutenberg/
  2. Delete all of the sample content
  3. Add a Paragraph with content "foo bar"
  4. Add a Quote with content "hello world"
  5. Select "bar" from line one and "hello" from line two.
  6. Press your OS keyboard shortcut to copy (CMD+C)
  7. Create a new line
  8. Press OS keyboard shortcut for paste (CMD+V)

Expected:

Ideally it would create a paragraph with content "bar" and a quote with content "world" - i.e. remove the expansion fallback logic and try to handle it.

Or it should perform the expansion to the full blocks and then copy the blocks to the clipboard.

Actual:

Nothing seemingly happens. Internally the selection now contains both full blocks.

Screenshots, screen recording, code snippet

Here I have selected between bar and hello, however the selection colours makes it look like both blocks are selected:

Screenshot 2023-09-05 at 16 00 24

Pressing CMD+C now expands the selection to the full blocks, but nothing changes visually:

Screenshot 2023-09-05 at 16 02 17

The user would need to press CMD+C a second time to copy the blocks.

Environment info

Mac OSX, Chrome.

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    [Feature] Block Multi SelectionThe ability to select and manipulate multiple blocks[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions