You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Button Inner Blocks: Allow buttons to inherit styling from existing inner blocks when pressing enter #65496
When a pattern is inserted that includes a Button block with specific styling, any additional buttons that are added when pressing enter after inserting the pattern do not automatically inherit the styling from the pattern. This means the new buttons do not match the intended pattern styling.
For example, when inserting the Heading, Paragraph, Button with Two Images pattern and then adding more buttons next to the existing "Sign up" button, the buttons will not match the pattern styling:
(I was using TT4 theme when testing this.)
What is your proposed solution?
Add the ability for an already styled inner block to share its styling with sibling inner blocks easily, ideally automatically. We should still allow users to customise individual inner blocks as usual.
I think we have this behaviour partially implemented. But only when clicking on the inserter? I remember working on it back in #37905, but it's been so long ago now, looking at that PR it's as if someone else wrote it 😆
In testing in trunk I can see that if I click the inserter, then the styles get copied across as expected. If, however, I press the enter key to create a new button block, the behaviour to copy the block attributes does not apply. As described in this issue, I think it should. Here's how it's looking to me:
changed the title [-]Button Inner Blocks: Allow buttons to inherit styling from existing inner blocks[/-][+]Button Inner Blocks: Allow buttons to inherit styling from existing inner blocks when pressing enter[/+]on Sep 20, 2024
Thanks for writing this up, @mikachan. This now works in trunk: #81250 unified what a new sibling block inherits, so pressing Enter in a styled button creates a new button with the same styling (everything except its text and metadata), just like the inserter and the appender. I checked it on a current trunk build with a pattern-style button, and the new button kept its colors, font size, border radius and weight. Closing as done.
Activity
andrewserong commentedon Sep 20, 2024
Thanks for writing this up!
I think we have this behaviour partially implemented. But only when clicking on the inserter? I remember working on it back in #37905, but it's been so long ago now, looking at that PR it's as if someone else wrote it 😆
In testing in
trunkI can see that if I click the inserter, then the styles get copied across as expected. If, however, I press the enter key to create a new button block, the behaviour to copy the block attributes does not apply. As described in this issue, I think it should. Here's how it's looking to me:2024-09-20.10.49.53.mp4
mikachan commentedon Sep 20, 2024
Ah yes, I can see that's how it's working for me too. So it's only if you press enter to insert a new block. I'll update the issue, thank you!
[-]Button Inner Blocks: Allow buttons to inherit styling from existing inner blocks[/-][+]Button Inner Blocks: Allow buttons to inherit styling from existing inner blocks when pressing enter[/+]youknowriad commentedon Oct 21, 2026
Thanks for writing this up, @mikachan. This now works in trunk: #81250 unified what a new sibling block inherits, so pressing Enter in a styled button creates a new button with the same styling (everything except its text and metadata), just like the inserter and the appender. I checked it on a current trunk build with a pattern-style button, and the new button kept its colors, font size, border radius and weight. Closing as done.