Make WordPress Core

Opened 14 months ago

Closed 13 months ago

Last modified 13 months ago

#56366 closed defect (bug) (fixed)

Twenty Twenty-One: Consider removing `.woocommerce` class from theme styles

Reported by: sabernhardt's profile sabernhardt Owned by: audrasjb's profile audrasjb
Milestone: 6.1 Priority: normal
Severity: normal Version:
Component: Bundled Theme Keywords: has-patch has-screenshots commit
Focuses: css Cc:


The selectors for Twenty Twenty-One's default max-width have used the .woocommerce class since the theme's initial commit.


.entry-content > *:not(.alignwide):not(.alignfull):not(.alignleft):not(.alignright):not(.wp-block-separator):not(.woocommerce),
*[class*="inner-container"] > *:not(.entry-content):not(.alignwide):not(.alignfull):not(.alignleft):not(.alignright):not(.wp-block-separator):not(.woocommerce) {

@davidbaumwald stated in ticket:56337#comment:11:

I don't think Core should have that code as it would need to be supported forever. This gets worse as WC evolves and changes its code which then requires more adjustments by Core.

Attachments (2)

56366.diff (1.1 KB) - added by tahmidulkarim 14 months ago.
WooCommerce test.png (160.9 KB) - added by mukesh27 14 months ago.

Download all attachments as: .zip

Change History (12)

#1 @audrasjb
14 months ago

  • Milestone changed from Awaiting Review to 6.1

Moving for 6.1 consideration.

#2 @audrasjb
14 months ago

  • Type changed from enhancement to defect (bug)

#3 @tahmidulkarim
14 months ago

  • Keywords has-patch added

This CSS style is reflected in the Cart and Checkout page. There is already a separate style for the twenty-twenty-one theme set from Woocommerce which overrides the current .entry-content style, so removing :not(.woocommerce) from the selectors doesn't have any effects on the existing styles. Here is a screenshot -

#4 @mukesh27
14 months ago

  • Keywords has-screenshots added

Hi there!

56366.diff works fine in WC pages. Thanks for the patch.

cc. @audrasjb for final review.

#5 @audrasjb
13 months ago

  • Owner set to audrasjb
  • Status changed from new to accepted

Looks good to me, thanks for the ping.
Self assigning for final testing and commit.

#6 @audrasjb
13 months ago

I spotted a few more occurrences.

#8 @audrasjb
13 months ago

  • Keywords commit added

Ready to go.

#9 @audrasjb
13 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 54170:

Twenty Twenty-One: Remove WooCommerce related CSS selectors.

The selectors for Twenty Twenty-One's default max-width have used the .woocommerce class since the theme's initial commit. This changeset removes all WooCommerce CSS selector from the theme, as they would need to be supported forever. The change was tested with WooCommerce installed and no issues were raised.

Props sabernhardt, audrasjb, davidbaumwald, tahmidulkarim, mukesh27.
Fixes #56366.

Note: See TracTickets for help on using tickets.