-
Notifications
You must be signed in to change notification settings - Fork 139
Description
Bug Description
As raised by one user in the support forums, in cases whereby third party plugins or WordPress core have existing inline styling added to elements of their site, without closing these rules (via a ; suffix), the Performance Lab plugin will insert it's own styling (ie. dominant color styling: --dominant-color: #736e5e;) merged in place with existing rules. This results in the dominant color styling not applying (along with the third party plugins inline styling).
While this isn't specifically a Performance Lab issue, to improve the likelihood of this happening, consider checking for pre-existing inline styling rules when inserting the dominant color and any other inline styling. If there is inline styling added via other means, check whether they are closed. If not, include a prefix ; to the dominant color styling.
Steps to reproduce
- Add a cover block to a WordPress post
- To ensure there is inline styling added, change the "Focal Point Picker", as per this recording. In this case, the inline styling will appear similar to: style="object-position:22% 59%"
- Check your sites source code, notice the inline styling isn't closed (doesn't have a semi colon)
- Enable the "Dominants Color module" within the Performance Lab configurations
- Notice that the styling added via the dominant color is merged with the Cover block styling, rendering both redundant
Screenshots
Below: Example of inline styling with the Cover block - notice there is no closing semi colon:
Below: Example of inline styling with the Cover block, with another plugin that also adds it's own inline styling to the same element - there is no distinction between the rules, they're merged.
Additional Context
- We do add a closing ; to the inline styling added via the Dominant Color option
- Tested on with WordPress 6.1.1 and newer Beta versions
- Separate GitHub issue raised on this over on the Gutenberg repo: Cover Block: Inline styling doesn't add a closing semicolon gutenberg#48258

