-
Notifications
You must be signed in to change notification settings - Fork 201
feat(fieldlabel): required asterisk vertical alignment #2166
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
Conversation
🚀 Deployed on https://pr-2166--spectrum-css.netlify.app |
fdd2866
to
bfbb60b
Compare
bfbb60b
to
a026cd8
Compare
@@ -176,7 +167,7 @@ governing permissions and limitations under the License. | |||
display: flex; | |||
flex-direction: column; | |||
|
|||
&+.spectrum-Form-item { | |||
& + .spectrum-Form-item { | |||
margin-block-start: var(--mod-field-label-top-to-asterisk, var(--spectrum-field-label-top-to-asterisk)); |
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.
Note: all usages of --spectrum-field-label-top-to-asterisk
can probably be removed from this file, as this margin within the Labels Above form appears to be using the wrong token and is the last place it's used. I'll make a cleanup update for the .spectrum-Form
related styles in a followup PR, as that was starting to escape the bounds of this PR's issue.
| `--mod-field-label-top-to-asterisk` | | ||
| `--mod-fieldlabel-font-size` | |
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.
I hadn't noticed it before, but our naming is inconsistent here, and I'm on the fence as to whether we should leave it alone or update it so that things are consistent. I think we might just want to leave it alone.
- Update the inline-block required icon to be vertically aligned at the baseline using the vertical-align property - Consolidate some repeated styles - Remove non-existant font-smoothing property
- Include note in docs about not adding extra space in markup for required icon. Previously, extra inline space was appearing in examples that was in addition to the defined margin-inline token. - Storybook fix: Add missing required class
Use isRequired field in stories, so the required asterisk is represented in VRTs. Along with wrapping label text.
a026cd8
to
7afa5e1
Compare
* feat(fieldlabel): required icon vertical-align - Update the inline-block required icon to be vertically aligned at the baseline using the vertical-align property - Consolidate some repeated styles - Remove non-existant font-smoothing property * docs(fieldlabel): note and change regarding extra inline space - Include note in docs about not adding extra space in markup for required icon. Previously, extra inline space was appearing in examples that was in addition to the defined margin-inline token. - Storybook fix: Add missing required class * docs(fieldlabel): add stories for required asterisk Use isRequired field in stories, so the required asterisk is represented in VRTs. Along with wrapping label text.
Description
Update the required asterisk icon (which is set to
display: inline-block
) to be vertically aligned with the baseline of the text using thevertical-align
property, instead of using new snapshot tokens. Removes some margin-block from the asterisk that was not needed.Also adds stories for required and wrapping + required, and updates the docs.
Note: Per confirmation with design about the original Slack discussion, the asterisk should stay inline at the end of the text. It's not currently achievable in Figma due to container/frame layouts in the tool. Because of that, the asterisk placement in Figma will not match the asterisk placement in code.
CSS-582
How and where has this been tested?
Please tag yourself on the tests you've marked complete to confirm the tests have been run by someone other than the author.
Validation Steps
Regression testing
Validate:
Screenshots
To-do list
I have read the contribution guidelines.
I have updated relevant storybook stories and templates.
I have tested these changes in Windows High Contrast mode.
If my change impacts other components, I have tested to make sure they don't break.
If my change impacts documentation, I have updated the documentation accordingly.
✨ This pull request is ready to merge. ✨