Checkboxes that are placed in labels break "Promotion options" settings summary

Created on 12 November 2017, about 7 years ago
Updated 30 January 2023, almost 2 years ago

When editing a node, Drupal shows "Promotion options" as a tab, with a settings summary beneath - see attached image.

In bootstrap theme, with "Use the administration theme when editing or creating content" enabled, the settings summary is missing.

The problem comes from Plugin\PreprocessFormElement code commented "Place single checkboxes and radios in the label field." This is a modification that is required in Bootstrap for checkboxes and radios to function properly.

However, this modification means that node.es6.js fails to find the element where it expects.

In this case, simply using .closest('label') instead of .next('label') will work for all.

        if ($optionsContext.find('input').is(':checked')) {
          $optionsContext.find('input:checked').closest('label').each(function () {
            vals.push(Drupal.checkPlain($.trim($(this).text())));
          });
          return vals.join(', ');
        }
🐛 Bug report
Status

Needs work

Version

10.1

Component
Node system 

Last updated 4 days ago

No maintainer
Created by

🇬🇧United Kingdom adamps

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.

  • The Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

Production build 0.71.5 2024