Skip to content

[6.x] Don't reserve space when a field's display label is hidden#14803

Merged
jasonvarga merged 3 commits into
6.xfrom
field-gaps
Jun 10, 2026
Merged

[6.x] Don't reserve space when a field's display label is hidden#14803
jasonvarga merged 3 commits into
6.xfrom
field-gaps

Conversation

@jasonvarga

Copy link
Copy Markdown
Member

Fixes #14707. Replaces #14710.

When a field hides its display label (hide_display), the field still rendered a label header containing the screen-reader-only label, which reserved ~8px of empty vertical space above the field.

Now, when a field's label has no visible content (no label text, required asterisk, lock avatar or sync icon), no field header is rendered at all — a screen-reader-only label is attached to the control instead, preserving accessibility without reserving space.

Along the way, the Field component's spacing was refactored to use container gap instead of per-element margins, and the nested header/text wrapper divs were flattened into a single header region. This made the empty-header case collapse cleanly and removed a redundant sr-only rule in the grid fieldtype CSS.

jasonvarga and others added 3 commits June 10, 2026 10:49
Spacing between a field's label, control, instructions and errors is now
owned by the container via `gap` rather than margins on each element, and
the nested header/text wrappers are flattened into a single header region.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
When a field hides its display label and has no other visible label
content (asterisk, lock avatar or sync icon), render no field header at
all and attach a screen-reader-only label to the control instead, so it
doesn't leave an empty gap above the field.

Fixes #14707

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Field headers inside grid table cells are already hidden by the existing
`.grid-cell` rule, so this selector had no effect.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jasonvarga jasonvarga merged commit 88196da into 6.x Jun 10, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Space is reserved when there is no label shown, creating a large unnecessary white space

1 participant