Describe the bug
When using the remove block keyboard shortcut on a reusable block, the block above is also deleted. It doesn't happen when I select 'remove block' from the ellipsis, or when using the keyboard shortcut on other blocks.
It only happens with reusable blocks (not a specific one) and regardless of the type of block above it (including another reusable block).
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Only the reusable block should be removed
Console error
I'm seeing the following errors, though I don't know if it's related
Uncaught Error: only one instance of babel-polyfill is allowed
at Object.
at Object.
at e (commons-820.min.js?ver=8.2:1)
at Object.
at e (commons-820.min.js?ver=8.2:1)
at commons-820.min.js?ver=8.2:1
at commons-820.min.js?ver=8.2:1
twp-templates.js?ver=1.1.5:101 Uncaught TypeError: Cannot read property 'replace' of undefined
at Object.t.refreshTitle (twp-templates.js?ver=1.1.5:101)
at refreshTemplateVars (twp-templates.js?ver=1.1.5:333)
Desktop (please complete the following information):
This not an easy issue to solve :)
Which means if the wrapper of a block is selected (it happens in reusable blocks but also in other blocks like images...), and you hit "ctrl + alt + backspace", you trigger both callbacks removing two blocks.
What do you think would be the best fix here?
Thoughs @aduth @talldan
Hey @youknowriad
Maybe we can add a check on the first callback to ensure "ctrl + alt" are not pressed?
That's how I ended up solving the issue in RichText ...
https://github.com/WordPress/gutenberg/blob/master/packages/editor/src/components/rich-text/index.js#L419
But hopefully that won't be needed in BlockListBlock - because of https://github.com/WordPress/gutenberg/issues/9036, the shortcut will be changed to something other than backspace, so that seems like the best way to solve it. (This reminds me I need to work on that again).
I'll work on something now to get the ball rolling on that again.
Thanks for the report @annestk! As briefly mentioned above, it looks like this shortcut is triggering two actions to remove blocks, and so two blocks are removed.
There's already a plan to change the shortcut to something else as there's a separate issue with this shortcut for linux users (#9036). I've opened pull request #10008 to do that.