[v4] A row whose fields are all hidden by their conditions still adds a field margin (regression from v3)

オープン 初心者向け
#19,976 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@paulw1982 がすでに取り組んでいます。

2026年11月27日 から。

  • #20005 @paulw1982 による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
next.js, react, typescript

調査の方向性

まず packages/ui/src/fields/Row/index.tsx と packages/ui/src/forms/RenderFields/index.css を確認し、次に #11504 と #16815 で削除された間隔のルールを比較します。リンクされた再現手順で空の行を再現し、非表示の子フィールドが行の間隔にどう影響するかを調べます。すべてのフィールドが非表示の行では間隔が追加されず、表示されている行では通常の間隔が保たれれば完了です。

索引モデルが issue の本文から書いたものです。

説明

area: ui Bug community-pr created-by: Contributor Payload OSS status: needs-triage v3-only
Describe the Bug

A row without an admin.condition of its own, whose fields are all hidden by their conditions, still takes up space in the form. Each such row adds an empty 24px gap, so two of them in a row leave a 48px hole between the fields around them.

RowField is wrapped in withCondition, which only checks the row's own condition, so the row always renders (Row/index.tsx#L25-L46). With every child hidden, what's left is an empty wrapper:

<div class="field-type row"><div class="render-fields row__fields"></div></div>

It is 0px tall, but as a .render-fields > .field-type it still gets margin-bottom: var(--spacing-field), 24px (RenderFields/index.css#L18-L19).

Now:

empty-rows-now

Without the empty rows' margin:

empty-rows-no-margin

Regression. This was reported for v3 in #11477 and fixed in #11504: the row got margin-bottom: 0, and .row__fields added the margin back only when it had a child (&:has(> *:nth-child(1))). Both rules were removed from Row/index.css in #16815, and nothing else accounts for an empty row now.

Expected: a row whose fields are all hidden takes no space, as in v3.

Link to the code that reproduces this issue

https://github.com/VeiaG/payload-4-reproductions/tree/repro-row-hidden-fields-keeps-margin

Reproduction Steps
  1. pnpm install, then pnpm dev, and open /admin/collections/posts/create.
  2. Look at the space between Show Details and After: 72px, against 24px between any other two fields.
  3. In DevTools, both .field-type.row elements are 0px tall with margin-bottom: 24px, and their .row__fields are empty.
  4. Check Show Details. Both rows show their fields and the spacing is normal.
Which area(s) are affected?

area: ui

Environment Info
payload: 4.0.0-beta.12
@payloadcms/ui: 4.0.0-beta.12
@payloadcms/next: 4.0.0-beta.12
next: 16.4.6
react: 19.3.1
Node: 24
主要言語
TypeScript
スター
46.1k
フォーク
4.5k
平均マージ
2日 1時間
マージ済み PR(30日)
222

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

payloadcms/payload のほかの issue

payloadcms/payload の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。