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

"Insert Before/After" settings menu buttons insert paragraphs inside InnerBlocks even if parent block disallows paragraph #10301

Closed
barryceelen opened this issue Oct 3, 2018 · 13 comments
Labels
[Feature] Inserter The main way to insert blocks using the + button in the editing interface [Feature] Nested / Inner Blocks Anything related to the experience of nested/inner blocks inside a larger container, like Group or P [Type] Bug An existing feature does not function as intended
Milestone

Comments

@barryceelen
Copy link
Contributor

The block settings menu for a nested block allows inserting a Paragraph block even if the parent block does not allow the Paragraph block as a child.

Steps to reproduce the behavior:

  1. Create a custom block with <InnerBlocks /> and disallow the Paragraph block as a child
  2. Insert a nested block
  3. Click the nested block's block settings menu button.
  4. The block settings menu shows the "Insert Before" and "Insert After" options. These insert a Paragraph block by default.

Expected behavior
The "Insert Before" and "Insert After" options should not be visible if the Paragraph block is not allowed as a child block.

Alternatively, an <Innerblocks /> block should be able to override the global default block, or if it only accepts one block type, that block should be used by the "Insert Before" and "Insert After" options.

Screenshots
image

@barryceelen barryceelen changed the title Block Settings Menu: remove Insert Before and Insert After if parent block disallows Paragraph Block settings menu: remove "Insert Before" and "Insert After" if parent block does not allow the paragraph block as a child Oct 3, 2018
@chrisvanpatten
Copy link
Member

@barryceelen #10136 (and its parent issue #8589) is working on an alternate "default" block option that would be available in contexts that don't support core/paragraph.

There's also some extra context at #6569.

To keep things contained I'll close this up but definitely recommend watching/commenting over at #8589 and #10136!

Thanks for the report :)

@chrisvanpatten chrisvanpatten added [Feature] Inserter The main way to insert blocks using the + button in the editing interface [Feature] Nested / Inner Blocks Anything related to the experience of nested/inner blocks inside a larger container, like Group or P [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed labels Oct 3, 2018
@barryceelen
Copy link
Contributor Author

Thanks for providing context @chrisvanpatten

@barryceelen
Copy link
Contributor Author

barryceelen commented Oct 4, 2018

@chrisvanpatten #10136 #8589 #6569 were merged and/or closed but did not address the issue mentioned here. Can we reopen this issue?

@chrisvanpatten
Copy link
Member

@barryceelen are you running from master? They won’t be fixed in the version distributed on WordPress.org until the next version of the plugin is released.

@barryceelen
Copy link
Contributor Author

@chrisvanpatten I am running the development version from master. Unless I'm super missing something, the issue with "Insert Before" and "Insert After" via the block settings menu that this particular ticket is about is not addressed/fixed via #10136, hence my request to reopen this ticket 💌.

@adamsilverstein
Copy link
Member

Create a custom block with and disallow the Paragraph block as a child

@barryceelen can you provide a code gist with a block that is set up this way we can drop in for testing?

@chrisvanpatten
Copy link
Member

chrisvanpatten commented Oct 5, 2018

Will reopen for now while we wait for a test case 👍

@chrisvanpatten chrisvanpatten reopened this Oct 5, 2018
@chrisvanpatten chrisvanpatten added [Status] Needs More Info Follow-up required in order to be actionable. and removed [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed labels Oct 5, 2018
@barryceelen
Copy link
Contributor Author

Thanks @adamsilverstein & @chrisvanpatten. I've created a block that accepts the core/html block only. A child html block's block settings menu will insert a default core/paragraph block.

https://gist.github.com/barryceelen/ee76376702c91c954d21973de396adc1

@Ipstenu
Copy link
Contributor

Ipstenu commented Oct 18, 2018

Related #10752

I can reproduce this on my custom block which is complex (sharable but I doubt you'd want to install it) but ABSOLUTELY does the same thing @barryceelen is seeing. Insert Before/After defaults to paragraph no matter what you put in. And yes, I tested on 4.0

@chrisvanpatten
Copy link
Member

More reports of this with #10752 and #10726 which I've consolidated here! @Ipstenu also had a great GIF in #10752 that's worth checking.

@barryceelen I'm going to rename your title to make it a little broader as the solution could be removing those menu options, or adding a block with the alternate appender introduced in #10136, or something else entirely!

@chrisvanpatten chrisvanpatten changed the title Block settings menu: remove "Insert Before" and "Insert After" if parent block does not allow the paragraph block as a child "Insert Before/After" insert paragraphs inside InnerBlocks even if parent block disallows paragraph Oct 18, 2018
@chrisvanpatten chrisvanpatten changed the title "Insert Before/After" insert paragraphs inside InnerBlocks even if parent block disallows paragraph "Insert Before/After" settings menu buttons insert paragraphs inside InnerBlocks even if parent block disallows paragraph Oct 18, 2018
@chrisvanpatten chrisvanpatten added [Type] Bug An existing feature does not function as intended and removed [Status] Needs More Info Follow-up required in order to be actionable. labels Oct 18, 2018
@Ipstenu
Copy link
Contributor

Ipstenu commented Oct 18, 2018

list-example

Uploading Gif here too so folks can see it.

The code I use is in https://github.com/LezWatch/lezwatch-library/tree/master/gutenberg/src/listicle which ... I am aware it's not optimal code.

@youknowriad
Copy link
Contributor

I think this might have been fixed recently, right @jorgefilipecosta?

@jorgefilipecosta
Copy link
Member

Hi @youknowriad, yes, this issue was fixed recently.

I'm closing the issue, thank you all for reporting it and providing additional information. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Inserter The main way to insert blocks using the + button in the editing interface [Feature] Nested / Inner Blocks Anything related to the experience of nested/inner blocks inside a larger container, like Group or P [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

7 participants