Skip to content
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

Increase the default space between form elements #3087

Closed
wants to merge 1 commit into from

Conversation

HDinger
Copy link
Contributor

@HDinger HDinger commented Sep 13, 2024

What are you trying to accomplish?

Currently, long forms are very hard to grasp. The elements are all very close together making it hard to recognize which text belongs to which input field. In this PR, I slightly increased the space between individual elements in a form to create a clearer visual differentiation.

Screenshots

Before After
Bildschirmfoto 2024-09-13 um 09 15 40 Bildschirmfoto 2024-09-13 um 09 12 34
Bildschirmfoto 2024-09-13 um 09 15 04 Bildschirmfoto 2024-09-13 um 09 18 38
Bildschirmfoto 2024-09-13 um 09 16 33 Bildschirmfoto 2024-09-13 um 09 13 07
Bildschirmfoto 2024-09-13 um 09 14 39 Bildschirmfoto 2024-09-13 um 09 13 41

Integration

No

List the issues that this change affects.

Closes #3042

Risk Assessment

  • Low risk the change is small, highly observable, and easily rolled back.

What approach did you choose and why?

Increase the space between form elements by using the --stack-gap-normal variable for the .FormControl-spacingWrapper instead of a custom space.

In the linked issue it was discussed whether we should touch the spacings on the form groups instead. I decided to not touch the groups here, as imho the framework should be able to render a good looking form without needing to wrap every element into an individual group.

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Added/updated previews (Lookbook)
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@HDinger HDinger requested review from a team as code owners September 13, 2024 07:22
@HDinger HDinger requested review from langermank and removed request for a team September 13, 2024 07:22
Copy link

changeset-bot bot commented Sep 13, 2024

🦋 Changeset detected

Latest commit: 1b98497

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/view-components Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@@ -60,7 +60,7 @@
.FormControl-spacingWrapper {
Copy link
Contributor

Choose a reason for hiding this comment

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

@camertron - is this class used for spacing between form control children (e.g.: label, input, caption) or is this class intended to add spacing between a set of form controls?

Copy link
Contributor

Choose a reason for hiding this comment

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

It adds spacing between individual form controls, not between constituent form control items like label, input, etc.

@HDinger
Copy link
Contributor Author

HDinger commented Oct 16, 2024

Hi everyone :) Are there any news on this? /cc @mperrotti @langermank @camertron

@camertron
Copy link
Contributor

Hey @HDinger, let me spot-check a few forms on github.com with this. If everything looks good, I'd be happy to merge it 😄

@camertron
Copy link
Contributor

camertron commented Oct 18, 2024

Ok, I spot-checked several forms on github.com and everything looks good. I actually prefer the increased spacing 😄 Here's an example of the difference:

Before After
A screenshot of a GitHub settings page showing four stacked radio buttons. The spacing between them is 0.5rem. A screenshot of a GitHub settings page showing four stacked radio buttons. The spacing between them is 1rem.

Unsurprisingly, these look very similar to @HDinger's screenshots 😄

@camertron
Copy link
Contributor

camertron commented Oct 18, 2024

@HDinger could you add a changeset?

Never mind, carry on.

@camertron
Copy link
Contributor

camertron commented Oct 18, 2024

Merged in #3159

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.

Form elements do not have sufficient vertical spacing
3 participants