Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block Settings Menu in Toolbar trying to render for a non-existing (just removed) block #15458

Closed
miina opened this issue May 6, 2019 · 2 comments · Fixed by #15543
Closed
Labels
[Feature] Block API API that allows to express the block paradigm. Needs Technical Feedback Needs testing from a developer perspective. [Type] Bug An existing feature does not function as intended

Comments

@miina
Copy link
Contributor

miina commented May 6, 2019

Describe the bug

When removing a block via Toolbar (using the menu with three dots -> selecting Remove Block) then the Block Settings Menu will still try to render again, this will result in either:
a) The preceding block's Toolbar being rendered instead with the Block Settings Menu already open (it shouldn't render open by default), or
b) If there is no block selected (e.g. if the paragraph block is unregistered), then this results in an error:
Screen Shot 2019-05-06 at 2 30 17 PM

To reproduce

Steps to reproduce the behavior:

  1. Add an Image block as the only block.
  2. Remove block via Toolbar:
    Screen Shot 2019-05-06 at 2 31 29 PM
  3. See the default Paragraph Toolbar opening with the Settings Menu already open.

Steps to reproduce the console error:

  1. Unregister core/paragraph block, e.g.
wp.domReady( () => {
	wp.blocks.unregisterBlockType( 'core/paragraph' );
} );
  1. Add a block, e.g. Image block as the only block.
  2. Remove the block via Toolbar
  3. See console / error display in the editor.

Expected behavior

  1. When removing a block via the Toolbar then the Toolbar should render for the next selected block without the Block Settings Menu being open.
  2. When removing the last block of a post via Toolbar and a new block isn't added by default (e.g. if the paragraph block is unregistered and alternative default block not enforced) then an error shouldn't occur.

Screenshots
Screen Shot 2019-05-06 at 2 40 33 PM

Screen Shot 2019-05-06 at 3 26 13 PM

Tested on the master branch as of today.
Also tested with the released 5.6.1 from official plugin repo -- with that version, a console error occurs but the editor doesn't crash.

@swissspidy swissspidy added [Type] Bug An existing feature does not function as intended [Feature] Block API API that allows to express the block paradigm. Needs Technical Feedback Needs testing from a developer perspective. labels May 7, 2019
@talldan
Copy link
Contributor

talldan commented May 10, 2019

  1. Unregister core/paragraph block, e.g.
    wp.domReady( () => {
    wp.blocks.unregisterBlockType( 'core/paragraph' );
    } );

For those testing, another option that doesn't involve code is to use the block manager to hide the paragraph block.

@talldan
Copy link
Contributor

talldan commented May 10, 2019

Also noticed the same thing was mentioned in the accessibility audit (#15313). That mentions that the issue of the non-closing dropdown occurs for all of the menu items.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block API API that allows to express the block paradigm. Needs Technical Feedback Needs testing from a developer perspective. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants