Skip to content

Support "new block defaults" (separate from general Block Defaults) #70633

@MadtownLems

Description

@MadtownLems

This request is a follow-up to a 7 year old issue where the current 'default' functionality was reported as a bug, and the conclusion was that this is expected behavior. This request attempts to approach the topic as a feature request instead of a bug.

What problem does this address?

Block definitions currently allows developers the ability to set certain default styles for blocks that will be used by any blocks that don't have those styles set. So, turn Buttons from Black to Red (provided the button wasn't customized in the editor to something else).

What's missing is the ability to set defaults only for NEW blocks. This would be incredibly useful, because it would let developers set new defaults going forward, improving the user experience, without impacting existing content.

A sample use case:
We use our theme on 100+ websites. Buttons that are inserted are Black by default. We've realized that almost nobody wants Black buttons, and almost everybody is turning them Red (one of our brand's main colors). We'd love to be able to set that any NEW Buttons that are inserted be Red - without impacting existing Buttons that are using the default black color.

What is your proposed solution?

In a method similar to how theme.json and block.json set default block colors, add a new property such as "newBlockDefaults" which can be configured with various styles and attributes which would be only be used for newly inserted blocks. Upon insertion, the block markup would immediately reflect these styles/attributes, as would the user interface (color pickers, etc).
(Care should be taken to make sure that blocks inserted as parts of Patterns don't use these defaults, as they should only apply to single blocks.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs DecisionNeeds a decision to be actionable or relevant[Feature] Block APIAPI that allows to express the block paradigm.[Type] EnhancementA suggestion for improvement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions