Double count message in themes that don't extend classy

Created on 5 June 2018, over 6 years ago
Updated 8 March 2024, 9 months ago

Problem/Motivation

Part of this problem was fixed in #2705485: Double count down message when text_long field has a description but it relies on .description class to be there. So if a theme doesn't add that class to the description element, we still get double counters.

Proposed resolution

TBD.

A workaround is to add it in your theme:

/**
 * Implements hook_preprocess_hook().
 */
function your_theme_preprocess_text_format_wrapper(&$variables) {
  // Add the description class if there is none, otherwise maxlength adds two
  // counter elements. See Drupal.behaviors.maxlength().
  if (!in_array('description', $variables['attributes']['class'])) {
    $variables['attributes']['class'][] = 'description';
  }
}

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

2.1

Component

Code

Created by

🇸🇮Slovenia primsi

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