-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Block highlight: Fix radius issue. #49864
Conversation
Sorry for the novella of a PR, but I feel it's important to document these details for posterity if this gets refactored in the future! |
Size Change: +132 B (0%) Total Size: 1.37 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works better than the alternative. ✅
Cool, thank you, let's try this! Let's also be mindful of any focus/highlight/multi-select issues in the coming releases, in case there are any side effects here. |
What?
Alternative to #49766. Fixes an issue where an improper radius was applied to social logos and more.
Blocks can be styled to have rounded corners, whether through a block style variation, or through the Border Radius tool.
We also use border radius in block UI, such as the block highlight (hover the drag handle), selection styles (select several blocks), or block focus (select an image block).
For the block UI, we've generally tried to avoid using pseudo selectors (::before/::after) as much as possible, to allow the theme itself to leverage those selectors. An older refactor removed one such selector in favor of painting the highlight style on the block itself. Unfortunately that meant the border radius overriding the radius set by the block. As an example:
Shown here:
This PR fixes that.
How?
This PR restores the pseudo selector (we still only "reserve" the ::after, so ::before is still unstyled and ready for themes to use). This ensures all those cases above work, as shown in this GIF:
I did have a different instinct to try as well, just reducing the specificity of the radius (as I do in this PR for the multi select style), but this had unintended side effects:
Shown in this GIF is a rounded site logo that is simultaneously multi selected, and highlighted. It shows duplicate highlight/focus states. This is in part due to how the site logo is built — the radius is applied to the block wrapper itself, and then inherited all the way down to the img inside, meaning that the radius would be applied to a random child div inside. That's perhaps not ideal behavior for the site logo, but nevertheless demonstrated to me why after all, it seems, we need the pseudo element approach.
Testing Instructions
Please test content that features a diversity of blocks, but most specifically include social logos (with background colors under the icons), together with the Site Logo, and ideally also any other blocks that support border radius (such as Image). With those in mind, please test:
In all cases, the UI (focus style and blue overlay) should have 2px radius, and in no cases should the "natural" radius of each block be affected.