Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
aaronjbaptiste opened this issue Sep 5, 2023 · 1 comment
Labels
[Feature] Block Multi Selection The ability to select and manipulate multiple blocks [Type] Bug An existing feature does not function as intended

Comments

@aaronjbaptiste
Copy link

aaronjbaptiste commented Sep 5, 2023

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

@justintadlock justintadlock added [Type] Bug An existing feature does not function as intended [Feature] Block Multi Selection The ability to select and manipulate multiple blocks labels Sep 5, 2023
@annezazu
Copy link
Contributor

annezazu commented Sep 6, 2023

@ellatrix tagging this for you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block Multi Selection The ability to select and manipulate multiple blocks [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

3 participants