-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redundant duplicate CSS for outline buttons inside a pattern #64422
Comments
Hi, |
Hi, @carolinan. According to the screenshot, I assume a unique identifier is being given. If multiple elements outside a pattern are given the Outline style, I assume they each get a different identifier. While the declaration is being duplicated in both cases, in the first case the selector is identical. Maybe I'm getting it wrong. Anyway, I first thought it was the case with all custom styling, but later I realized it wasn't the case, so maybe it's negligible. Thanks. |
I can replicate this issue on the frontend. The editor however appears fine. In the editor, the individual styles for applications of block style variations (to support nested block styles) use the block's clientId which is unique per block. On the frontend though, there isn't a unique client ID available so the block style variation filter uses the same approach as element styles and generates a hash from the block's attributes. As the outline button block in the repeated pattern is exactly the same this creates a non-unique ID. Before the extended block style variations feature landed there was a bit of a refactor so that the unique (well, supposedly unique 😅) class name was generated and added to the block attributes in one place. I believe it could be possible to tweak the classname there to ensure uniqueness. My bandwidth is looking rather limited in the near future so if someone else would like to take a run at a fix, I'd be happy to review. Otherwise, I'll see if I can't slot this one into a gap sometime. |
Thanks, @aaronrobertshaw! 🙏 I will check it out. |
Description
When a button is given the Outline style, it gets a CSS code in the page's header. When the button is placed inside a pattern, and the pattern is being used multiple times on the page, the CSS is being added as many times. See screenshot
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
https://1drv.ms/i/s!AhEX_VIY1-zfhdIJg--yzum4z_QBbQ?e=0YhAbd
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
The text was updated successfully, but these errors were encountered: