Skip to content

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

Description

@martyf

Bug description

This is a Group fieldtype, with the Display Label turned off. "Text Field" is a child of the Group.
Image

The rendered markup includes the sr-only markup for the Label, but there are two margins added: one is mb-2 in the Field.vue, and the other is a mb-1.5 in the Label.vue (See #14710).

If a Label is not shown, it should not have elements that take up visible space: basically it means that a Field without the Label shown will have a 8px extra gap above it.

For example:
Image

I've looked in to a PR for this but is challenging because at the Field level it is not able to cleanly determine whether the Label will actually render any content or not.

How to reproduce

  1. Create a new Statamic site
  2. Set up a Global with the below Blueprint
title: 'Group Test Hidden Label'tabs:
main:
display: Mainsections:
-
display: Sectionfields:
-
handle: group_fieldfield:
fullscreen: falsetype: groupdisplay: 'Group Field'hide_display: truefields:
-
handle: text_fieldfield:
type: textdisplay: 'Text Field'
-
display: 'New Section'fields:
-
handle: group_field_2field:
fullscreen: falseborder: falsetype: groupdisplay: 'Group Field'hide_display: truefields:
-
handle: text_fieldfield:
type: textdisplay: 'Text Field'
-
display: 'New Section2'fields:
-
handle: group_field_duplicatefield:
fullscreen: falseborder: falsetype: groupdisplay: 'Group Field (Duplicate)'fields:
-
handle: text_fieldfield:
type: textdisplay: 'Text Field'

Environment

EnvironmentLaravel Version: 13.11.2PHP Version: 8.4.21Composer Version: 2.9.5Environment: localDebug Mode: ENABLEDMaintenance Mode: OFFTimezone: UTCLocale: enCacheConfig: NOT CACHEDEvents: NOT CACHEDRoutes: NOT CACHEDViews: NOT CACHEDDriversBroadcasting: logCache: fileDatabase: sqliteLogs: stack / singleMail: logQueue: syncSession: fileStoragepublic/storage: NOT LINKEDStatamicAddons: 0License Key: Not setSites: 1Stache Watcher: Enabled (auto)Static Caching: DisabledVersion: 6.19.0 Solo

Installation

Fresh statamic/statamic site via CLI

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions