Add: Panel form layout validation#73700
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. |
55f5246 to
f3b263e
Compare
|
@jorgefilipecosta I get the following error when trying to build Storybook so I can't test: In any case, does the |
Looking for a fix. Locally the build was running on and it worked. |
f3b263e to
fb49062
Compare
|
Size Change: +734 B (+0.03%) Total Size: 2.58 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in 5cb1d3c. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/20195434307
|
|
Hi @jameskoster, the issue should be fixed. |
|
Thanks, it's working now :) Could you add a field to the story where |
Glad the problem was fixed. Working on the additional story. |
|
Hi @jameskoster the story was updated to test label none, and I also implemented the functionality to have validation on this case which we were missing. It should look like this in the current version: |
ef1f78b to
ae3e74a
Compare
| .dataforms-layouts-panel__field-label-content { | ||
| display: inline-flex; | ||
| align-items: center; | ||
| cursor: help; |
There was a problem hiding this comment.
This cursor doesn't seem to apply when labelPosition is none.
There was a problem hiding this comment.
Good catch, it was fixed.
| <HStack className="dataforms-layouts-panel__field dataforms-layouts-panel__field--label-position-none"> | ||
| { showError && ( | ||
| <Tooltip text={ errorMessage } placement="top"> | ||
| <span className="dataforms-layouts-panel__field-error-indicator"> |
|
I left a couple of small notes. I'm not sure why we use the |
Thank you for the cacthes, all of them were fixed 👍 |
Yes it seems like something we could fix. As it is not related to the validation I can gladly work on it on another PR. I also found another issue while developing this. If we make the text field empty when label position is not, the field is not rendered anymore and we can not open the panel at all, the user gets no way to fix the issue, which I will also fix in a different PR. |
This one is being fixed at #73764. |
| } ) ) | ||
| } | ||
| /> | ||
| <PanelValidationSection |
There was a problem hiding this comment.
Instead of adding a panel, can we add a new control to the story that allows users to switch between regular and panel layouts? That way, we can test all existing component types in both scenarios.
There was a problem hiding this comment.
Hi @oandregal, I reimplemented the story now we have a control to change the layout between panel, card and regular on the validation story.
1f2d254 to
06e9061
Compare
|
Hi @jameskoster, @oandregal I think all the feedback was applied. Be ware that now to test the story we need to change the layout under the controls panel: |
|
|
||
| const labelContent = showError ? ( | ||
| <Tooltip text={ errorMessage } placement="top"> | ||
| <span className="dataforms-layouts-panel__field-label-content"> |
There was a problem hiding this comment.
Probably not a big deal but could this be an HStack?
| const labelContent = showError ? ( | ||
| <Tooltip text={ errorMessage } placement="top"> | ||
| <span className="dataforms-layouts-panel__field-label-content"> | ||
| <span className="dataforms-layouts-panel__field-error-indicator"> |
There was a problem hiding this comment.
Do we need the span? Could we just add the class to the Icon instance below instead?
|
Thanks for making those changes @jorgefilipecosta, I think this is in a decent spot in terms of design. |
This reverts commit 1490580.
711aa0a to
5369bfb
Compare
|
Hi @oandregal, I just rebased this PR, I think it should be ready. |
oandregal
left a comment
There was a problem hiding this comment.
This is a great first step, thanks!
A follow-up we need to look at is when validation messages are displayed. I know we've discussed that input validation messages aren't displayed until it loses focus (the 1st time). But that pattern creates weird experiences with panel layout validation.
Note these situations in which the panel reports the error before the relevant input does:
Screen.Recording.2025-12-18.at.14.01.29.mov
|
Thank you for the reviews @oandregal and @jameskoster! |



Summary
Adds validation indicators to the panel layout in DataForm. When a field has validation errors, a red warning icon with tooltip appears next to the field label.
Part of: #72321
Details
Screenshot
cc: @oandregal, @jameskoster
Test plan