Pressing backspace at the start of a paragraph block before a classic text block causes the classic text block to be deleted
Issue Overview
It appears the merging logic has a problem with merging a paragraph block into an existing classic text block (aka freeform). If you press backspace at the start of a paragraph block that is directly after a classic text block then instead of merging with the classic text block it deletes the classic text block.
Steps to Reproduce (for bugs)
- Create a paragraph block with identifiable content
- Create a classic text block with identifiable content
- Create a paragraph block with identifiable content
- Position cursor at the start of the last paragraph block
- Press backspace
Expected Behavior
I expect that either the merge will be rejected and nothing will happen or that the paragraph block following the classic text block will be appended at the end of the classic text block.
Current Behavior
The classic text block is deleted and the cursor is placed at the end of the first paragraph block. The second paragraph block remains unchanged.

When I try to pause the merge in the debugger I can't replicate the problem!
Right, after a frustrating debugging session I think the cause is thus:
- The user presses the backspace key down.
- The key down event triggers the MERGE_BLOCKS handler in editor/effects.js
- The MERGE_BLOCKS handler fails to convert the block so it falls back to just focusing the previous block
- The focus of the classic text block succeeds
- The user releases the backspace key
- The onKeyUp handler on the calls removeOrDeselect which detects the backspace and decides that the user is trying to delete the block and calls onRemove
- The classic text block is removed
@iseulde Is there any reason why the removeOrDeselect function could not be run onKeyDown instead of onKeyUp?
@youknowriad or @aduth do you know if there is a reason that removeOrDeselect (in editor/modes/visual-editor/block.js) needs to run on the key up handler? Could it be run on the key down handler to fix this bug?
I think we could try onKeyDown if it's not causing any other issue
Ok, I will put in a pull request with the change. My tests did not show any obvious problems but it seemed that it had been put in the onKeyUp handler deliberately.
PR: https://github.com/WordPress/gutenberg/pull/2599