#61877 closed defect (bug) (fixed)
Block Styles: Ensure unique classname generation for variations
Reported by: | aaronrobertshaw | Owned by: | ramonopoly |
---|---|---|---|
Milestone: | 6.7 | Priority: | normal |
Severity: | normal | Version: | trunk |
Component: | Editor | Keywords: | gutenberg-merge has-patch |
Focuses: | Cc: |
Description
This ticket tracks the backporting of PHP files for the following Gutenberg updates:
These changes include a fix to ensure unique class names when exact copies of blocks with a block style variation applied occur on the same page e.g. when repeatedly inserting the same synced pattern. Unique class names are required to ensure block style variations can be applied in a nested fashion.
Change History (7)
This ticket was mentioned in PR #7200 on WordPress/wordpress-develop by @aaronrobertshaw.
7 weeks ago
#1
- Keywords has-patch added
@aaronrobertshaw commented on PR #7200:
5 weeks ago
#2
Thanks for flagging that @mukeshpanchal27 👍
I wasn't too sure on whether the test should be removed or just flagged as expecting the deprecation. I went with flagging the expected deprecation so it can be removed once the deprecated function is.
#3
@
5 weeks ago
- Owner set to ramonopoly
- Resolution set to fixed
- Status changed from new to closed
In 58951:
Trac ticket: https://core.trac.wordpress.org/ticket/61877
This PR backports the PHP changes from https://github.com/WordPress/gutenberg/pull/64511.
### What?
Simplifies block style variation class name generation to ensure unique class.
### Why?
Avoids potential for non-unique class names and conflicting styles when exact copies of a block are inserted via a repeated pattern.
Further background and context can be found over on https://github.com/WordPress/gutenberg/pull/64511.
### How?
Replace the hashing of block attributes in the block style variation classnames with a call to
wp_unique_id
.### Testing Instructions
#### Confirm unique classnames on frontend
is-style-outline-
. You should find CSS with three styles matching that pattern however they should now all be unique.#### Ensure no regressions for block style variations on the frontend
<details>
<summary>Example block style variation theme.json partial (place under
/styles
)</summary></details>
## Screenshots or screencast
### Simple unique classnames for exact copies of blocks
### Block Style Variations still working
https://github.com/user-attachments/assets/42998ead-0b03-48ab-8968-f4b0688fb661