-
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
Search Block: Removed components class from icon button and polished css #33961
Conversation
Size Change: -35.5 kB (-3%) Total Size: 1.03 MB
ℹ️ View Unchanged
|
Hey Maggie 👋 - thanks for the PR! Can you expand a bit on what problem this PR solves? Using a regular |
I'll let Maggie expand if I missed anything. But from what I understand, the reason to not use the Button component is that this is not block editor UI, and the WordPress Components are for block editor UI only. This is actually for content/markup meant to be rendered on the frontend. Which means things like It also allows us to seriously relax specificity, as there's less to override. This one is no longer needed: This is testing well for me, thanks for the PR. When I was building my block theme, this was a point of frustration for me as well. While you're here, and in the spirit of decoupling frontend styles and markup further from block editor interface styles, should we replace the $grid-unit variable on https://github.com/WordPress/gutenberg/pull/33961/files#diff-e34c10093220bf04a0cd482cd0b4c217973f815654e58dcdff848534b923cc0bR34? Honestly just explicitly writing 8px instead, seems better. While I don't think we'll ever change the content of the $grid-unit-10 variable for spacing rules in the block editor, if we were to do that, it would affect the appearance of the search box here as well. Might as well just detach it. |
@jasmussen you put it perfectly, we stumbled upon the triple selector and I thought we should come back to this and make it right because it's annoying for theme developers. And I agree about the variable here, I hadn't noticed those sass variables were only for the editor interface but that makes total sense. |
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.
Nice work. I missed one final variable that would be nice to fix while you're here. This tests well for me and simplifies and reduces the specificity.
I'd love a quick sanity check by @ntsekouras to make sure I didn't miss any context to his question, otherwise, ship it!
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.
But from what I understand, the reason to not use the Button component is that this is not block editor UI, and the WordPress Components are for block editor UI only
That makes sense! Thanks!
Description
After #26446 was merged there was a level of specificity in the CSS created to bring inline the editor and frontend styles that is being caused by the components classes present on the icon button. This PR refactors the button to use the regular button tag instead and removes the extra specificity from the CSS. I also went ahead and refactored the styles that were no longer needed after this change and that were causing mismatches between the editor and the frontend.
How has this been tested?
I tested on Emptytheme using the following markup:
Screenshots
The differences in sizes between editor and frontend are caused by Emptytheme not defining font-family or font-size while the editor does (and tries to reset it with little success). I'd love to improve this so we can have the same on the frontend and the editor but I'm unsure as to what's the correct approach for this.
Before:
After:
Types of changes
Checklist:
*.native.js
files for terms that need renaming or removal).