Skip to content

refactor(fieldlabel): spectrum-Form cleanup and fixes #2173

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

Merged
merged 4 commits into from
Oct 13, 2023

Conversation

jawinn
Copy link
Collaborator

@jawinn jawinn commented Sep 18, 2023

Description

.spectrum-Form cleanup and fixes (this CSS exists within the fieldlabel component)

  • Fixes missing spacing between form items in Labels Above variant. This was using the wrong token (top-to-asterisk)
  • Removes --spectrum-field-label-top-to-asterisk as it is no longer used
  • Cleans up the CSS and its custom properties a bit. Adds some additional -mod properties.
  • Removed two comments that were no longer applicable. One mentioned a docs file that does not seem to exist anymore, and the other mentioned a token value of 20px but it didn't equal 20px.
  • Fixes form negative margin being too large and it moving outside its container. Instead use same value as border-spacing to remove the extra space, to make this like a margin top and bottom of zero which seems like the intention.
  • Adds Form stories to Storybook (previously did not exist within Storybook)
  • Fixes some incorrect markup around field group in the examples

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

  • Standard variant looks the same in example docs
  • Margins between items in Labels above variant looks correct (no longer smushed) @jawinn I confirmed this one with the design team
  • Negative margin on Standard form equals the border spacing; content no longer overflows its container (screenshot below shows previous behavior)
  • Two new stories appear for "Form" and look okay
  • Adjusted example markup around field group looks correct

Regression testing

Validate:

  1. A legacy documentation page (such as accordion), including:
  • The page renders correctly
  • The page is accessible
  • The page is responsive
  1. A migrated documentation page (such as action group), including:
  • The page renders correctly
  • The page is accessible
  • The page is responsive

Screenshots

Negative margin bug in prod (negative margin too large):
Screenshot 2023-09-15 at 7 23 28 PM

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. ✨

@github-actions
Copy link
Contributor

github-actions bot commented Sep 18, 2023

🚀 Deployed on https://pr-2173--spectrum-css.netlify.app

@github-actions github-actions bot temporarily deployed to pull request September 18, 2023 15:12 Inactive
@jawinn jawinn force-pushed the jawinn/fix-fieldlabel-form-cleanup branch from c0bfbb7 to ec2fa8f Compare September 18, 2023 16:36
@github-actions github-actions bot temporarily deployed to pull request September 18, 2023 16:41 Inactive
@jawinn jawinn force-pushed the jawinn/fix-fieldlabel-form-cleanup branch from cd82d6b to 9690fa5 Compare September 19, 2023 20:46
@github-actions github-actions bot temporarily deployed to pull request September 19, 2023 20:52 Inactive
@github-actions github-actions bot temporarily deployed to pull request September 19, 2023 21:30 Inactive
@jawinn jawinn force-pushed the jawinn/fix-fieldlabel-form-cleanup branch from 112a6cc to 1dd9d0f Compare September 19, 2023 21:46
@github-actions github-actions bot temporarily deployed to pull request September 19, 2023 21:52 Inactive
Copy link
Collaborator

@mdt2 mdt2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! We talked offline about getting the space between fields validated by design, but they are looking more spacious to me.

@jawinn
Copy link
Collaborator Author

jawinn commented Sep 26, 2023

LGTM! We talked offline about getting the space between fields validated by design, but they are looking more spacious to me.

I checked with the design team and they're good with that updated spacing on the "Labels Above" variant.

- Fixes missing spacing between form items in Labels Above variant.
  This was using the wrong token (top-to-asterisk)
- Removes --spectrum-field-label-top-to-asterisk as it is no longer used
- Cleans up the CSS and its custom properties a bit
- Removed two comments that were no longer applicable. One mentioned
  a docs file that does not seem to exist anymore, and the other
  mentioned a token value of 20px but it doesn't equal 20px.
- Fixes form negative margin being too large and it moving outside its
  container. Instead use same value as border-spacing to remove the
  extra space, to make this like a margin top and bottom of zero which
  seems like the original intention.
Buttons will default to a type of "submit" within a form, resulting in
unexpected form submission on click, which was happening in the
examples. Sets type="button" on usage of button element used for the
picker in the docs.
Add stories for the "Form" component that exists as its own entry in the
docs (the CSS actually exists within the fieldlabel component).
- Fix incorrect field group usage in example markup for Form. Previously
  had a "for" attribute for an ID that didn't exist, and was using a
  label. But this was more of a fieldset usage and needed to use the
  aria attributes (reference Field group).
- Improves some titles and descriptions to be more clear about alignment
@jawinn jawinn force-pushed the jawinn/fix-fieldlabel-form-cleanup branch from 1dd9d0f to 30d7f69 Compare October 13, 2023 17:34
@github-actions github-actions bot temporarily deployed to pull request October 13, 2023 17:39 Inactive
@pfulton pfulton added the run_vrt For use on PRs looking to kick off VRT label Oct 13, 2023
@github-actions github-actions bot removed the run_vrt For use on PRs looking to kick off VRT label Oct 13, 2023
@pfulton pfulton merged commit 9c4a620 into main Oct 13, 2023
@pfulton pfulton deleted the jawinn/fix-fieldlabel-form-cleanup branch October 13, 2023 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants