You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've created a custom block style for applying rounded corners to block images. However, after a recent WP core update I noticed my block styles were being overridden by the core block library css. It resets the border-radius for all block images to border-radius: inherit. So now I need to increase the specificity of my css in order to apply my styles. The high specificity of this css makes it difficult to apply custom styles and sets a precedent where I'm worried my custom styles will be overridden by a core update.
Is there a reason why the block image css wasn't simply written as .wp-block-image img { border-radius: inherit; }?
The :not() selector is being used in many places in core, which has a comparatively high specificity and is therefore increasingly difficult to override. The use of this technique needs to be reviewed by whomever (or by the team) is “in charge” of Core/Editor CSS.
This issue has been resolved via #31366, which leverages new feature level selectors for block supports to target the inner img. This meant the problematic style wasn't required anymore and was subsequently removed.
I'll close this issue now however if you have any further concerns or questions, please let me know.
Is there a reason why the block image css wasn't simply written as .wp-block-image img { border-radius: inherit; }?
I believe this was because the suggested selector wouldn't allow custom border radii set by end users to take precedence.
Activity
markhowellsmead commentedon Jan 25, 2022
The :not() selector is being used in many places in core, which has a comparatively high specificity and is therefore increasingly difficult to override. The use of this technique needs to be reviewed by whomever (or by the team) is “in charge” of Core/Editor CSS.
See also #36135, #35840, #34047, #29705, #17511.
aaronrobertshaw commentedon Aug 10, 2022
This issue has been resolved via #31366, which leverages new feature level selectors for block supports to target the inner img. This meant the problematic style wasn't required anymore and was subsequently removed.
I'll close this issue now however if you have any further concerns or questions, please let me know.
I believe this was because the suggested selector wouldn't allow custom border radii set by end users to take precedence.