-
Notifications
You must be signed in to change notification settings - Fork 817
Forms: Fix outline style label font size #43590
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
base: update/migrate-form-fields-to-inner-blocks
Are you sure you want to change the base?
Forms: Fix outline style label font size #43590
Conversation
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
@@ -809,7 +810,6 @@ | |||
position: relative; | |||
top: 50%; | |||
transform: translateY(-50%); | |||
will-change: transform; |
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.
For most fields, transform
actually doesn't change it stays at transform: translateY(-50%);
, so I've removed this.
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 🔴 Action required: Please add missing changelog entries for the following projects: Use the Jetpack CLI tool to generate changelog entries by running the following command: Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Fixes and issue I noticed while working on JETPACK-277
Note - this merges into #42890 rather than trunk.
Proposed changes:
If a user creates a form and uses the Outlined form style variation, they can no longer adjust the global styles font size of labels for any inputs that are focused, have a placeholder, or if the field is a Single/Multi choice field. This only happens in #42890, in trunk it works fine.
The issue is that we're attempting to use a
font-size: 0.8em
to scale the font to a smaller size when a field is focused, but this rule completely overrides thefont-size
applied by global styles. Block styles can also override the0.8em
, so have the opposite effect.The fix I've taken is to move the
font-size: 0.8em
rule to a child element, so it correctly scales the inherited font size from any global/block styles that are set on the parent. In the editor there's already a child element that can serve this purpose. On the frontend, there is no element, so a newspan
has been added. This might be a good idea anyway, as it makes the markup more like the editor, although it's not an exact match.As part of this, the PR also updates the scaling of the required text, which is usually 85% of the size of the label so that it works consistently.
With the font size moved to a different element, a new
transition
also has to be implemented for the font-size scaling, otherwise it looks jarring when clicking into or out of a field.Other information:
Jetpack product discussion
p1747968046579529-slack-C02A76B714Z
Does this pull request change what data or activity we track or use?
No
Testing instructions:
Expected: The font size should visible change:

Before: The font size stayed the same:
