Skip to content

Conditionally show or hide inspector settings depending on other block settings #36972

@priethor

Description

@priethor

What problem does this address?

As of Gutenberg 12.0, all color options available to a text block are shown in the inspector sidebar, such as Color, Background Color, and Link Color. However, some blocks like Post Date and Post Date can work entirely as links or plain text, making options like Color and Link Color mutually exclusive.

In the example below, the Color and Link Color of a Post Date block have been set to red and blue, respectively. As we can see, by toggling the Link setting option Make title a link, the full block toggles between a link or plain text, thus both color options are mutually exclusive.

Grabacion.de.pantalla.2021-11-29.a.las.20.35.40.mov

What is your proposed solution?

Being able to conditionally show or hide the relevant style options depending on the state of other block settings would improve the user experience. In the case of Post Title and Post Date blocks, Color or Link color would be shown depending on the value of Make title a link.

In the case of Post Author, it can't contain links so the Link Color option never applies and should be hidden.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Block] Post AuthorAffects the Post Author Block[Block] Post DateAffects the Post Date Block[Block] Post TitleAffects the Post Title Block[Feature] Inspector ControlsThe interface showing block settings and the controls available for each block[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