Fieldset elements with #description_display set as before are outputted as a prefix

Created on 21 March 2023, almost 2 years ago
Updated 14 August 2024, 4 months ago

Problem/Motivation

When using a fieldset element and adding a description to it, it is outputted as a prefix instead of a description. This occurs when the description_display is set as 'before'. Since Drupal 9.3, the fieldset template has been updated and the logic in the Webform module is no longer required. The change happened in: https://www.drupal.org/project/drupal/issues/2396145 β†’ and was also noted in https://www.drupal.org/node/3143489 β†’ . The fieldset.html.twig template now makes use of #description_display.

Steps to reproduce

  1. Install and enable the Webforms module in Drupal.
  2. Go to /admin/structure/webform/config/elements. Under 'Element general settings', look for 'Default description display' and select the 'before' option.
  3. Create a new form and add a fieldset to it. Enter something in as it's description.
  4. You'll notice the markup has the "field-prefix" wrapper as it's outputting to {{ prefix }} in the fieldset.html.twig template.
  5. The expected outcome is to use the {{ description }} instead.

Proposed resolution

To fix the issue, we can remove the outdated logic from within hook_preprocess_fieldset() in the theme include.

Remaining tasks

  • Test the updated module thoroughly to ensure that the fix is working as intended.
  • Add a patch to remove the outdated code.

User interface changes

There are no user interface changes with this fix.

API changes

There are no API changes with this fix.

Data model changes

There are no data model changes with this fix.

πŸ› Bug report
Status

Fixed

Version

6.1

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia hoffismo Brisbane, Queensland

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

Comments & Activities

Production build 0.71.5 2024