Form no label too greedy

Created on 4 June 2021, over 4 years ago
Updated 23 July 2025, 3 months ago

Problem/Motivation

The feature of hiding labels for form elements is too greedy for more complex form elements that have subelements.

Steps to reproduce

Add a form element that has subelements with labels to a block form and set the #title_display of the element to 'invisible'.
When using that element in a form inside the LB configuration, you will notice that the subelements are missing their title too.

$form['new_password'] = [
  '#type' => 'password_confirm',
  '#title' => t('New password'),
  '#title_display' => 'invisible',
];

Proposed resolution

Change the CSS selector for labels that should be hidden so that it is targeting only direct children of the form element:
.glb-form-no-label > label

Remaining tasks

Review the issue and think about side effects of the proposed change.
Review patch.

User interface changes

None

API changes

None

Data model changes

None

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇩🇪Germany berliner

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024