Skip to content

DataForm: Remove the minimum row height from the regular layout, so rows size to their content. - #82052

Open
ntsekouras wants to merge 3 commits into
trunkfrom
df/remove-min-height-regular-layout-field
Open

ntsekouras wants to merge 3 commits into
trunkfrom
df/remove-min-height-regular-layout-field

Conversation

@ntsekouras

Copy link
Copy Markdown
Contributor

What?

Noticed while reviewing: #81987 (review)

The regular layout applies a 32px min-height to every field row. For readonly fields without a visible label and some controls like checkbox and toggle this results in an extra vertical gap.

This PR removes the min-height, so rows size to their content. I couldn't find a reason for this being intentionally set and I think it's safe to remove. Alternatively we could target only the readonly fields.

Side label rows are not affected, since the label and control columns have their own min-heights.

Screenshots

Check the readonly fields (File size, Dimensions) and toggle/checkbox fields (Allow people to leave a comment, Sticky).

Before After
before-labelnone-readonly after-labelnone-readonly
before-labelnone-toggles after-labelnone-toggles

Testing Instructions

  1. Open the DataForm LayoutRegular story in Storybook (npm run storybook:dev) - ?path=/story/dataviews-dataform--layout-regular.
  2. Set the labelPosition control to none and check that the readonly fields (File size, Dimensions) and toggle/checkbox fields (Allow people to leave a comment, Sticky) don't reserve extra vertical space.
  3. Check the other label positions and ensure everything else is intact.

@ntsekouras ntsekouras self-assigned this Aug 26, 2026
@ntsekouras ntsekouras added [Type] Bug An existing feature does not function as intended [Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond labels Aug 26, 2026
@github-actions github-actions Bot added the [Package] DataViews /packages/dataviews label Aug 26, 2026
@github-actions

github-actions Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
Co-authored-by: jasmussen <joen@git.wordpress.org>
Co-authored-by: oandregal <oandregal@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@jasmussen

Copy link
Copy Markdown
Contributor

Nice fix. I'm curious why the rule was there in the first place 🤔

@github-actions

github-actions Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

Size Change: -27 B (0%)

Total Size: 7.92 MB

📦 View Changed
Filename Size Change
build/styles/edit-site/style-rtl.css 21.8 kB -3 B (-0.01%)
build/styles/edit-site/style-rtl.min.css 17.9 kB -3 B (-0.02%)
build/styles/edit-site/style.css 21.8 kB -2 B (-0.01%)
build/styles/edit-site/style.min.css 17.9 kB -3 B (-0.02%)
build/styles/editor/style-rtl.css 31.8 kB -3 B (-0.01%)
build/styles/editor/style-rtl.min.css 27.2 kB -6 B (-0.02%)
build/styles/editor/style.css 31.8 kB -3 B (-0.01%)
build/styles/editor/style.min.css 27.2 kB -4 B (-0.01%)

compressed-size-action

@oandregal

oandregal commented Aug 26, 2026 •

Copy link
Copy Markdown
Member

I took a look at git history and this seems to come from this PR #66531 (~2 years ago). We didn't have read-only fields then, and perhaps we also didn't have all the controls we have today. It's possible that this rule is no longer useful. There's been multiple iterations that changed the original value to tokens as well.

However, there's also a chance that it is useful but in the wrong place. We have now layouts to compose how fields are positioned (e.g., row layout). That stands out as a case that may be potentially affected? Worth checking:

Screenshot 2026-08-26 at 11 18 54

With this kind of change, as long as design is happy, I'm happy :)

@jasmussen

Copy link
Copy Markdown
Contributor

Looks good to me. Presumably we can add it back if there's a case we didn't account for!

@ntsekouras
ntsekouras force-pushed the df/remove-min-height-regular-layout-field branch from 2944b91 to f1aee1f Compare August 28, 2026 07:28
@ntsekouras

Copy link
Copy Markdown
Contributor Author

@jasmussen for the record, @oandregal's comment about row layout results in the visible change below:

dataform-row-alignments-side-by-side.mp4

Noting that only controls shorter than the old 32px min-height (checkbox/toggle) move at all, everything else in the video is pixel-identical

Before the end alignment looked a bit more centered due to the extra space from min-height. I'd argue it's better like this, and if a more centered look is wanted for a row, that's what the default alignment (center) already does.

It can be a bit misleading in the video about what is the default, but intentionally in the story we set different defaults in the rows, in order to see the different alignments directly without changing through the storybook control. Picking any explicit value then forces every row to that value.

So, if we're fine with this, I'd appreciate a ✅ . 😄

@jasmussen

Copy link
Copy Markdown
Contributor

Indeed, the main change here is how the "has discount" checkbox dangles. Which is a head-scratcher. It seems like we can either:

  1. Suggest that the design that puts a checkbox on its own like that, sans-label, is a form design you should avoid.
  2. Find some workaround that allows the checkbox to retain its alignment when "alignment end" is used.

Is that fair/exhaustive? One consideration: the checkbox does have a 32px footprint, through its 24px default height and then 4px margin above and below—so it's the margin collapse that makes it become 24px in the latter case. This is important for the checkbox when it's used as one of several in a list. Also worth noting, those inputcontrols may be 40px tall right?

Should the checkbox in the example story be wrapped in a BaseControl, and would that fix the issue, and option 2?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond [Package] DataViews /packages/dataviews [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants