Multi-selection: faulty click-and-drag text selection at edges and across blocks #53128
Description
Description
Click-and-drag selection at the edges of paragraph blocks and across blocks of varying types results in unexpected highlighting and selections.
As demonstrated in the attached video, when using click-and-drag selection, the highlighted selection in the editor may not represent the actual selection that will be copied/pasted. The typical highlight applies to entire blocks while the actual selection may be null, a subset of text, or some combination of nearby blocks.
Similarly, the editor may report "X blocks copied" while the blocks were in fact not copied.
This seems to be a long-standing bug. I had assumed for some time that this was a personal issue, plugin conflict, or browser extension incompatibility, but having taken the time to test in isolation, the issue remains. I've observed this since at least WordPress 6.1.
Shift-click selection does not appear to result in the same behavior.
Step-by-step reproduction instructions
- Create a new post or page
- Insert various paragraph blocks inter-mingled with other blocks
- Starting mid-paragraph, click and drag to the bottom edge of the block and into the next block
- Observe highlighted area
- Copy using keyboard shortcut
- Paste to verify clipboard contents
Screenshots, screen recording, code snippet
gutenberg-click-and-drag-selection-issue.mp4
Environment info
Replicated using:
- Mac OS 13.4.1
- WordPress 6.3
- Chrome Version 114.0.5735.248 (Official Build) (arm64)
- Safari 16.5.2 exhibits slightly different but still unexpected behavior
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