[WIP] Block Editor: Add contextual label for block inserter button#71160
[WIP] Block Editor: Add contextual label for block inserter button#71160shrivastavanolo wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Thanks for this PR.
I was looking at the same problem in #71502. I think there's some overlap here and it's possible both approaches can co-exist.
I think there are some situations where we might want to change this label to not be about blocks at all.
For example, in the Navigation block, the concept of "block" is less applicable. We want the appender to read Add page because the "Page link" variation is the default block for the Nav block. I wonder how this can be achieved.
I also note that the addition of the block title/name here increases the verbosity of the tooltip. However, I see that accessibility feedback has noted this would be an enhancement in that regard. We should probably request some design feedback here as well so that we can strike a balance that works for all users.
I also see that once I add a Group the appender + that appears still reads Add block
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |

What?
Closes #71162
This PR updates the block inserter button label to show a contextual and clearer message when adding new blocks inside a parent block. Instead of the generic "Add block" tooltip, it shows "Add block to [Parent Block Title]" where applicable (e.g., for navigation menu items).
Why?
The generic "Add block" tooltip can be confusing when adding items inside blocks like the Navigation block, where users expect to add a new menu item rather than just a generic block. This change improves clarity by specifying the type of item being added based on the parent block's title.
How?
ButtonBlockAppendercomponent now receives aparentBlockTitleprop and uses it to customize the button label.Insertercomponent obtains the parent block title by retrieving the parent block's block type title or name and passes it down as a prop._xandsprintf) with translator comments for internationalization support.Reference taken from here: #45238 (comment)
Testing Instructions
Screencast
Before
Screen.Recording.2025-08-11.at.12.22.50.PM.mov
After
Screen.Recording.2025-08-11.at.12.57.01.PM.mov