-
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: Apply font-related style inheritance to input field #60321
Conversation
Size Change: +1.39 kB (0%) Total Size: 1.72 MB
ℹ️ View Unchanged
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
Thanks for this PR @t-hamano
Before | After |
---|---|
Things are working as described. I think we're missing one declaration text-transform: inherit;
text-decoration
is unset here:
text-decoration: unset !important; |
So I guess we don't need that.
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.
Thanks for this enhancement @t-hamano 👍
It's testing mostly as advertised. There's still a couple of typography related styles missing though.
- Text transform (as Ramon noted)
- Font style
You can see the italic font style getting picked up by the search block's label but not the input in the screenshot below:
Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com>
Thank you for noticing what I had missed! I added the missing styles and updated the screenshot as well. |
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.
Appreciate the quick iteration @t-hamano 👍
The input is inheriting all the applicable typography styles now on both the frontend and in the editor.
I did notice one inconsistency between the editor and frontend for the button though. The search block's button doesn't inherit the text transform style on the frontend. Taking a closer look at the button's styles might be a good follow-up.
Editor | Frontend |
---|---|
Nice catch on |
@aaronrobertshaw @ramonjd Thanks for the review!
Thank you for finding it. I would like to file an issue regarding this point. |
…rdPress#60321) * Search Block: Apply font-related style inheritance to input field * Add missin styles Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> --------- Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: ramonjd <ramonopoly@git.wordpress.org> Co-authored-by: aaronrobertshaw <aaronrobertshaw@git.wordpress.org> Co-authored-by: gigitux <gigitux@git.wordpress.org>
Fixes #60174
What?
This PR adds CSS properties to the input element inside the Search block that inherits font-related styles. This ensures that when typography styles are defined at the root level, they are correctly applied to the input element as well.
The screenshot below is from Emptytheme:
Before
After
Why?
According to MDN, form-related elements are browser-specific and do not inherit font-related styles. This is not an issue when typography-related styles are applied at the block level in the global styles or on individual blocks, but it becomes an issue when typography-related settings are applied at the root level in the global styles.
How?
Applies CSS to the input element that inherits all font-related styles. We also use :where to reduce the CSS specificity so that we can override this style. Only
text-decoration
is not inherited. This is because it causes problems with text input, as discussed in #43499.Ideally, it would be more convenient to define these styles for the input field in the default theme.json, but the current theme.json does not support input elements.
Testing Instructions
Screenshots or screencast
f84aae4f7cc8273f8e705b0bc2b371b7.mp4