-
Notifications
You must be signed in to change notification settings - Fork 4.6k
DataForms regular layout: Remove label style overrides as they cause inconsistent results #71574
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
DataForms regular layout: Remove label style overrides as they cause inconsistent results #71574
Conversation
|
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: -84 B (0%) Total Size: 1.93 MB
ℹ️ View Unchanged
|
jorgefilipecosta
left a comment
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.
The change looks good and greatly improves the consistency of labels.
Yeah, we also need to fix that. This happens because it's not handled by the Edit component (a component from the components package) but by DataForm itself here. It's the same case as the side label. This is why we need to use the "label component" in DataForm (or creating one if there's none): so the case of the label is delegated to the underlying system. |
Good points! I'll merge this PR in as it addresses the immediate concern, and we can look at how we might reliably inject label components in follow-up(s). Thanks for the reviews! |
…inconsistent results (WordPress#71574) * DataForms: Remove label style overrides as they cause inconsistent results * Add changelog entry Co-authored-by: andrewserong <[email protected]> Co-authored-by: jorgefilipecosta <[email protected]> Co-authored-by: oandregal <[email protected]>
I'm not sure what the desired design is for the side label position, but in order to get better visual consistency for the top label position, I've opened up a follow-up PR in #71597 that looks to use the visual label for the |

What?
Follow-up to: #71495
Remove the CSS in the DataForms' regular layout that overrides the styles provided by the base control label.
Why?
Currently the styling overrides of the regular layout are inconsistent, and within DataForm controls we have a mix of components that do or don't use the base control label, resulting in different styles for different components.
The idea behind this PR is that the regular layout shouldn't be prescriptive in this way, and let the underlying components do their thing. The result should be a greater level of consistency in controls. To observe this, try looking at the regular layout Storybook story for DataForm in trunk compared to this PR.
In particular I ran into this issue with the textarea control as its label appeared to look different to the other comparable labels.
How?
Remove the CSS affecting this component.
Testing Instructions
npm run storybook:devScreenshots or screencast
Before
Not the label on Description looks different to the label on Tags:
After
Now the label is consistent:
Note: this change should have no impact on the "side" labelPosition, as these styles have no effect on how labels are rendered in that mode: