youknowriad / blockbook

Build and Share WordPress Blocks in Isolation.
http://youknowriad.github.io/blockbook/
GNU General Public License v3.0
160 stars 17 forks source link

Handle focusing outside the editor to unselect block #34

Open johnstonphilip opened 4 years ago

johnstonphilip commented 4 years ago

When you click on a block, there's no way to unselect it. So even if your focus moves to another part of the page, or you click outside the block that is currently selected, it remains selected.

You can see this in action by following these steps:

  1. Go here: https://youknowriad.github.io/blockbook/block/core---audio/editor
  2. Click on the block to select it, notice its toolbar pops up
  3. Click outside the block somewhere.
  4. Notice the block does not become unselected.

Sidenote: I am not totally sure if this is something to solve here in BlockBook, or if its a Gutenberg-specific issue. But since the actual Editor in Gutenberg/WordPress does unselect blocks when you click outside them, it would seem this might be an implementation detail of the project using the core-editor package.