Describe the bug
When using backspace to delete blocks, the preceding block is correctly selected after the removal takes place.
However, when using the delete key, the behaviour is the same and the preceding block is still selected. To be consistent with how the delete key works normally when deleting text, the start of the next block should instead be selected
To Reproduce
Steps to reproduce the behavior:
- Create a new post
- Add four paragraphs of text
- Select the middle two paragraphs
- Press the delete key (you may need to use fn+backspace on a laptop)
- Observe that the caret is placed in the first block
Expected behavior
The caret is positioned at the start of the last block
Additional context
- Gutenberg 3.5
- The code that handles the delete event is in the component
EditorGlobalKeyboardShortcuts (this seems to be triggered for multi-selection) or BlockListBlock (when there's only a single block selected). Currently, they trigger the removeBlocks action, but the removeBlocks is not passed any data about the direction of the delete event. Delete and Backspace are both handled in the same way.
- It would be beneficial to add test cases to the block-deletion e2e test when fixing this.
Describe the bug
When using backspace to delete blocks, the preceding block is correctly selected after the removal takes place.
However, when using the delete key, the behaviour is the same and the preceding block is still selected. To be consistent with how the delete key works normally when deleting text, the start of the next block should instead be selected
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The caret is positioned at the start of the last block
Additional context
EditorGlobalKeyboardShortcuts(this seems to be triggered for multi-selection) orBlockListBlock(when there's only a single block selected). Currently, they trigger theremoveBlocksaction, but theremoveBlocksis not passed any data about the direction of the delete event. Delete and Backspace are both handled in the same way.