-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Data forms: achieve vertical spacing with vertical spacing rather than cell padding #70435
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
…re to ensure alignment with a neighbouring button. However for read only fields, there might be no button. Furthermore, it's better to adjust padding using the container gap spacing rather than tweaking the padding on a single column for alignment.
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. |
Size Change: -2 B (0%) Total Size: 1.85 MB
ℹ️ View Unchanged
|
@@ -48,7 +48,7 @@ export function DataFormLayout< Item >( { | |||
); | |||
|
|||
return ( | |||
<VStack spacing={ 2 }> | |||
<VStack spacing={ 4 }> |
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.
This is to compensate for the padding that I delete further down.
Might be useful to make this configurable through the form
prop or something.
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.
Nit - should it be 5
instead of 4
?
Removing the padding means 12px
less for each field label, so that's 3 spacing units.
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.
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.
Just an idle thought (and not a blocker for now), but I wonder if the vertical spacing should be configurable to support dense or more spaced out layouts, given that label position is already configurable? Of the two, 4
looks a little better to me visually than 5
, but I'm no designer 😄
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.
Yeah, I thought the form prop object might be a good candidate.
line-height: $grid-unit-05 * 5; | ||
hyphens: auto; | ||
align-self: center; |
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.
Required because one cell might be taller than the other.
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.
It looks much better, so I think this can be merged. The exact spacing could always be adjusted later if needed.
Thanks for testing! Looks like the E2E fails are the same that are failing for all branches. |
…re to ensure alignment with a neighbouring button. However for read only fields, there might be no button. Furthermore, it's better to adjust padding using the container gap spacing rather than tweaking the padding on a single column for alignment. (WordPress#70435) Co-authored-by: ramonjd <ramonopoly@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: andrewserong <andrewserong@git.wordpress.org>
What?
This PR removes padding around data forms labels, and bumps up the VStack spacing gap to achieve vertical spacing.
Why?
There is a misalignment between label and control.
The label padding is allegedly there to ensure alignment with a neighbouring button. However for read only fields, there might be no button.
Furthermore, it's better to adjust padding using the container gap spacing rather than tweaking the padding on a single column for alignment.
Testing Instructions
Fire up story book
npm run storybook:dev
And head to the Dataforms component: http://localhost:50240/?path=/story/dataviews-dataform--combined-fields
Play around with the variables, especially side views. Ensure that the label and controls align in the centre.
Testing Instructions for Keyboard