Copying a partial unmergable block has no visible effect (and copy fails) #54193
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:
- 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.
- 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
- Go to https://wordpress.org/gutenberg/
- Delete all of the sample content
- Add a Paragraph with content "foo bar"
- Add a Quote with content "hello world"
- Select "bar" from line one and "hello" from line two.
- Press your OS keyboard shortcut to copy (CMD+C)
- Create a new line
- 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:
Pressing CMD+C now expands the selection to the full blocks, but nothing changes visually:
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