Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#46432 closed defect (bug) (fixed)

Twenty Nineteen: Improve custom color behavior for InnerBlocks

Reported by: kjellr's profile kjellr Owned by:
Milestone: 5.2 Priority: normal
Severity: normal Version:
Component: Bundled Theme Keywords: has-patch has-screenshots
Focuses: Cc:

Description

Like Gutenberg, Twenty Nineteen includes some default color rules to prevent unreadable text. For instance, if you choose to give a paragraph a dark gray background (from the theme's custom palette), the text will switch to be white by default.

This works great for individual blocks, but it causes some interference with nested blocks. Currently, if a parent block has a custom background color assigned, its child blocks will inherit the parent's text colors — even if the child block has its own custom text color assigned to it.

You can try this out by creating a Media + Text block:

  1. Assign the block itself a dark-colored background.
  2. Assign background and text colors to one of the interior paragraph blocks.

This will show up correctly in the editor:

https://cldup.com/bBYNJuKuKg-2000x2000.png

In the frontend however, the text color will be incorrect:

https://cldup.com/XDHBkCxwUz-3000x3000.png

This is because the child block is inheriting the theme's "default" text color from the blue parent block.

The included patch adjusts Twenty Nineteen's custom background color defaults to target direct children only. When applied, this example will show up correctly on the front end:

https://cldup.com/SL-tIArdQl-2000x2000.png

Attachments (1)

46432.patch (14.9 KB) - added by kjellr 6 years ago.

Download all attachments as: .zip

Change History (11)

@kjellr
6 years ago

#1 @allancole
6 years ago

This looks good @kjellr. Gonna go ahead and commit this to trunk.

#2 @allancole
6 years ago

In 44818:

Twenty Nineteen: Improve custom color behavior for InnerBlocks

Currently, if a parent block has a custom background color assigned, its child blocks will inherit the parent's text colors — even if the child block has its own custom text color assigned to it.

This update changes the following:

  • Adjusts Twenty Nineteen's custom background color defaults to target direct children only which fixes the issue

Props kjellr.

See #46432.

#3 @desrosj
6 years ago

  • Keywords close added

This seems like it's all set. @allancole can you confirm?

This ticket was mentioned in Slack in #core by jeffpaul. View the logs.


6 years ago

#5 @andraganescu
6 years ago

  • Keywords commit added

#6 @desrosj
6 years ago

  • Keywords commit removed

@andraganescu can you clarify what is ready for commit here? It appears that the necessary changes have already been committed and that no further action is needed.

#7 @andraganescu
6 years ago

Yes you are right @desrosj i didn't pay attention to the fact that the diff was committed already. Nothing to do!

#8 @desrosj
6 years ago

  • Keywords close removed
  • Resolution set to fixed
  • Status changed from new to closed

Closing this out. @kjellr or @allancole, if there is action remaining on this one that I missed, please reopen!

#9 @kjellr
6 years ago

I believe it's all set. Thanks, all!

#10 @allancole
6 years ago

Yup, this should be all good, @desrosj :-)

Note: See TracTickets for help on using tickets.