Make WordPress Core

Opened 16 months ago

Last modified 10 months ago

#60408 new defect (bug)

Twenty Nineteen: Theme block styles are not applied to blocks in the widget area

Reported by: poena's profile poena Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 5.8
Component: Bundled Theme Keywords: needs-patch needs-testing
Focuses: css Cc:

Description

Twenty Nineteen adds extra styling for some blocks, but on the front, the styles use
the class names .entry .entry-content as part of the selector:

.entry .entry-content .wp-block-button .wp-block-button__link:not(.has-background) {
  background-color: #0073aa;
}

So the styles are applied in the post content area, but not applied to blocks placed in the widget area.

The blocks in the widget area on the front does not match what is in the widget admin screen.

Attachments (4)

widget-area-front--buttons.png (22.8 KB) - added by poena 16 months ago.
The button block in the widget area, on the front of the site
widget-area-editor--buttons.png (22.5 KB) - added by poena 16 months ago.
The button block in the widget area, on the widget admin screen
60408-twentynineteen-button-styles-editor.png (99.9 KB) - added by ajmcfadyen 16 months ago.
Editor footer widget styles twentynineteen theme
60408-twentynineteen-button-styles-frontend.png (200.9 KB) - added by ajmcfadyen 16 months ago.
Twentynineteen theme footer button widget styles bug

Download all attachments as: .zip

Change History (9)

@poena
16 months ago

The button block in the widget area, on the front of the site

@poena
16 months ago

The button block in the widget area, on the widget admin screen

@ajmcfadyen
16 months ago

Editor footer widget styles twentynineteen theme

@ajmcfadyen
16 months ago

Twentynineteen theme footer button widget styles bug

#1 @karmatosed
14 months ago

  • Keywords needs-patch added

#2 @sabernhardt
13 months ago

  • Focuses css added
  • Milestone changed from Awaiting Review to Future Release
  • Version set to 5.8

#3 @karmatosed
12 months ago

  • Keywords needs-testing added

Adding the keyword to get testing on this, thank you.

#4 @poena
10 months ago

@sabernhardt @karmatosed Hi!
In your opinion, what would be the preferred solution for making sure that the theme block styles are applied to blocks in the widget area, not only the post content?

  • Apply the styles by adding a selector with .widget-area
  • Removing .entry .entry-content selector

Relevant files:
https://core.trac.wordpress.org/browser/branches/6.6/src/wp-content/themes/twentynineteen/sass/blocks/_blocks.scss#L127

https://core.trac.wordpress.org/browser/branches/6.6/src/wp-content/themes/twentynineteen/inc/color-patterns.php#L70

#5 @sabernhardt
10 months ago

I have not tried to implement any of these, but I can share my preferences for the concepts.

  1. If .entry .entry-content can be removed without changing the post content's appearance, that would be my preference. However, those styles may need a higher specificity to override something.
  2. If the selectors need higher specificity but one class is enough, I would suggest replacing .entry .entry-content with .site. The color patterns function uses .entry .button (without .entry-content), which suggests that that needed one extra class to override a selector.
  3. If it needs two class-level selectors, :root .site might work.
  4. Hopefully the stylesheet would not need to copy all of those selectors with a .widget-area variation.
Last edited 10 months ago by sabernhardt (previous) (diff)
Note: See TracTickets for help on using tickets.