Make WordPress Core

Opened 6 weeks ago

Last modified 6 weeks ago

#62624 new defect (bug)

Fix global styles for Separator blocks when theme defines non-background colors

Reported by: aaronrobertshaw's profile aaronrobertshaw Owned by:
Milestone: 6.8 Priority: normal
Severity: normal Version: trunk
Component: Editor Keywords: gutenberg-merge has-patch has-unit-tests
Focuses: Cc:

Description

This ticket tracks the backport of PHP files for the following Gutenberg updates:

https://github.com/WordPress/gutenberg/pull/67269

These updates include a fix so a user's selection of background color for the Separator block in Global Styles is honored regardless of whether a theme also defines non-background colors for that block.

Further background and context is available within the original issue:

Change History (1)

This ticket was mentioned in PR #7927 on WordPress/wordpress-develop by @aaronrobertshaw.


6 weeks ago
#1

  • Keywords has-patch has-unit-tests added

Trac ticket: https://core.trac.wordpress.org/ticket/62624

This PR brings the changes from the following Gutenberg PRs to core:

### Description

Removes the old fudging of style declarations for Separator block styles in favour of a more robust and consistent approach within the theme.json revolver.

The Separator block styles are now tweaked within the theme.json resolver's get_theme_data and get_user_data methods. This allows a subtle difference in handling based on the origin of the user data.

Theme data (from theme.json) containing a background color style for the Separator block will now use that as a fallback for color.text and border.color style paths. This allows the Separator block's different rendering approaches that rely on different CSS properties to use a consistent color.

User origin data, such as a color selection made in Global Styless, is now enforced across the different color paths. This means the user's selection is now honoured regardless of which block style, and therefore rendering method the Separator block employs.

A more detailed breakdown and discussion can be found on the GB PR: https://github.com/WordPress/gutenberg/pull/67269

### Test Instructions

  1. Activate a theme that defines color styles for the Separator block e.g. TT4 or TT5
  2. In the site editor, navigate to Styles > Blocks > Separator and apply a background color
  3. Save and confirm the correct color on the frontend.
    • If using TT5 for testing, note that the "Dots" block style requires the JS package updates for the editor to enforce the user selection.
  4. Reset Global Styles.
  5. Confirm that the Separator block styles coming from the theme.json are consistent with trunk.

### Screenshots

#### Before
https://github.com/user-attachments/assets/ec82eb85-cb59-4f65-b9b2-002a507b8477

_Note the overlaid color on top of the user-selected yellow in the above screenshot. This is due to the theme's styles not being overridden for non-background properties on trunk._

#### After
https://github.com/user-attachments/assets/76fc8ed8-1d82-41be-884f-c09097b22910

Note: See TracTickets for help on using tickets.