Skip to content

Fix: Buttons block shows inserter picker when multiple allowed blocks are registered#77858

Merged
Mamaduka merged 2 commits into
WordPress:trunkfrom
adithya-naik:fix/buttons-block-multiple-allowed-blocks-#77839
May 6, 2026
Merged

Fix: Buttons block shows inserter picker when multiple allowed blocks are registered#77858
Mamaduka merged 2 commits into
WordPress:trunkfrom
adithya-naik:fix/buttons-block-multiple-allowed-blocks-#77839

Conversation

@adithya-naik

Copy link
Copy Markdown
Contributor

What

Fixes Buttons block not showing inserter picker when multiple allowed blocks are registered.

Why

The current logic only checks for core/button variations and ignores multiple allowed block types, so it always inserts the default button.

How

Update directInsert logic:

directInsert: !hasButtonVariations && !hasMultipleAllowedBlocks;

Result

  • Single block → direct insert (no change)
  • Multiple blocks → shows inserter picker
image

Testing

  1. Add a custom button block
  2. Allow it inside core/buttons
  3. Click ➕ inside Buttons block

Picker should appear.

Issue

Fixes #77839

@github-actions

github-actions Bot commented Apr 30, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: adithya-naik <adithyanaik@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: mikeybinns <mikeybinns@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions github-actions Bot added the [Package] Block library /packages/block-library label Apr 30, 2026
@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended [Block] Buttons Affects the Buttons Block labels May 1, 2026
@Mamaduka

Mamaduka commented May 1, 2026

Copy link
Copy Markdown
Member

Thanks for working on this, @adithya-naik!

I think we can remove the directInsert setting in this case + all useSelect logic. The appender already has all this info and will automatically derive the direct insertion conditions. That's exactly what the inline comment suggested as an improvement, which is now already in place.

P.S. Rebasing on top of the trunk should resolve the failing e2e test.

@Mamaduka

Mamaduka commented May 1, 2026

Copy link
Copy Markdown
Member

Okay, it seems there's a minor issue with copying attributes when directInsert isn't specified, but that doesn't change the fix for the Buttons block.

We'll need to fix the attributes to copy the issue first and then land this. @stokesman, I think you were already working on it - #54409. Do you have time to continue work on that PR? I can also take over and handle it.

@adithya-naik

adithya-naik commented May 1, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the clarification!

You can take it up and merge it @Mamaduka , and then we can proceed with merging this PR.

@Mamaduka

Mamaduka commented May 5, 2026

Copy link
Copy Markdown
Member

@adithya-naik, just merged #77877, which resolves the underlying issue. Now should be able to fix this via #77858 (comment).

Don't forget to rebase on top of the latest trunk.

@adithya-naik

Copy link
Copy Markdown
Contributor Author

@adithya-naik, just merged #77877, which resolves the underlying issue. Now should be able to fix this via #77858 (comment).

Don't forget to rebase on top of the latest trunk.

Sure @Mamaduka I will do as instructed.

Thanks!

@adithya-naik adithya-naik force-pushed the fix/buttons-block-multiple-allowed-blocks-#77839 branch from a085deb to ad4d838 Compare May 5, 2026 16:43
@adithya-naik

Copy link
Copy Markdown
Contributor Author

@adithya-naik, just merged #77877, which resolves the underlying issue. Now should be able to fix this via #77858 (comment).

Don't forget to rebase on top of the latest trunk.

Done @Mamaduka , All Runs are successfull.

@Mamaduka Mamaduka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @adithya-naik!

@Mamaduka Mamaduka merged commit 369e71e into WordPress:trunk May 6, 2026
40 checks passed
@github-actions github-actions Bot added this to the Gutenberg 23.2 milestone May 6, 2026
talldan pushed a commit that referenced this pull request May 8, 2026
… are registered (#77858)

Co-authored-by: adithya-naik <adithyanaik@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: mikeybinns <mikeybinns@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Buttons Affects the Buttons Block [Package] Block library /packages/block-library [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Button group doesn't easily support adding custom buttons

2 participants