Pressing Delete with a multi-block selection spanning from a paragraph doesn't delete
Issue Overview
When a multi-selection spans from a paragraph block, pressing <del> or <backspace> does not delete the selected blocks.
Steps to Reproduce (for bugs)
- Create multiple paragraph blocks.
- Select from the text of one paragraph down to the last paragraph
- Press Delete
Browser: Chrome
Expected Behavior
All the selected blocks will be deleted.
Current Behavior
There are two behaviours:
a) if you selected some text in the first block, then that text is just deleted b) if you hadn't selected any text in the first block (so you started dragging from past the last word), then it triggers a merge operation with the next block so it looks like some deletion has occurred, but not the deletion that you wanted.
Possible Solution
It's caused by the fact that Delete / Backspace is being handled by the editor (either deleting text or firing merge). I'm going to try and make the editor in read-only mode whenever a multi-selection has occurred and see what that looks like. That may or may not be a solution.
Related Issues and/or PRs
Todos
- [x] Tests
- [x] Documentation
Another approach will be to focus the outer container and remove selection from the window.
So stopping focus going through to the block itself (passing null) when there is a multi-selection works fairly well, but after deleting the blocks, there is no block focused. Investigating how to resolve that.
This also affects blocks like Heading, but the fix attached covers all cases. 👌
This was last fixed in #2934 I believe, after it had been broken for a while. Would be great to know what broke it again.