gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Cover Block: Default text color overrides each nested block text color

Open CreativeDive opened this issue 7 years ago • 6 comments

Hey,

if I have a custom nested block inside the cover block, the default styles for heading + text of the cover block overrides all the colors of the headings + text from my custom nested blocks. In my case I use a nested block which is created with Advanced custom fields pro.

Heading color issue:

Nov-06-2019 13-59-36

Color bug comes from cover block default styles:

.wp-block-cover-image .wp-block-subhead:not(.has-text-color), .wp-block-cover-image h1:not(.has-text-color), .wp-block-cover-image h2:not(.has-text-color), .wp-block-cover-image h3:not(.has-text-color), .wp-block-cover-image h4:not(.has-text-color), .wp-block-cover-image h5:not(.has-text-color), .wp-block-cover-image h6:not(.has-text-color), .wp-block-cover-image p:not(.has-text-color), .wp-block-cover .wp-block-subhead:not(.has-text-color), .wp-block-cover h1:not(.has-text-color), .wp-block-cover h2:not(.has-text-color), .wp-block-cover h3:not(.has-text-color), .wp-block-cover h4:not(.has-text-color), .wp-block-cover h5:not(.has-text-color), .wp-block-cover h6:not(.has-text-color), .wp-block-cover p:not(.has-text-color) {
    color: inherit;
}

THIS OVERRIDES ALL NESTED TEXT COLORS, if an element is not directly formatted like .my-custom-block h2 {color:red}

Text color issue:

Nov-06-2019 13-59-55

Color bug comes from cover block default styles:

.wp-block-cover-image .wp-block-cover__inner-container, .wp-block-cover .wp-block-cover__inner-container {
    width: calc(100% - 70px);
    z-index: 1;
    color: #f8f9f9;
}

THIS OVERRIDES ALL NESTED TEXT COLORS, if an element is not directly formatted like .my-custom-block p {color:red}

By the theme, default colors for headings or paragraphs are styled like:

h1, h2, h3, h4, h5, h6 {color:blue} or body {color:pink} or p {color:green}

BUT THE COVER BLOCK OVERRIDES ALL THIS FORMATTINGS by default. That must not be. With the default cover block text color styles, all my nested blocks are not readable with the default text color.

In another case, the group block as the wrapper block (instead of the cover block) correctly displays all text color formatting for nested content and is not overridden by the default group block styles.

CreativeDive avatar Nov 06 '19 13:11 CreativeDive

same issue

silvanarnet avatar Nov 07 '19 08:11 silvanarnet

+1, same issue. I use a group block inside the cover block and the group block sets its own background and appropriate contrasting (text) color. But the cover block default styles prevent this for elements inside of it. I already tried to make the selector ridiculously specific, but it doesn't really seem to work.

strarsis avatar Jan 21 '20 23:01 strarsis

This seems fixed for me, at least when I tested with a group block defining its own colors, the result matches the expectation. Anyone able to confirm?

youknowriad avatar Aug 26 '20 22:08 youknowriad

I can't replicate either, seems to have been fixed already. :+1:

aristath avatar Aug 27 '20 08:08 aristath

I can confirm, this is fixed.

CreativeDive avatar Aug 27 '20 10:08 CreativeDive

Perfect, I'll go ahead and close this one then :+1:

aristath avatar Aug 27 '20 10:08 aristath