Character count not updating due to incorrect DOM traversal in JS

Created on 16 June 2025, 20 days ago

Problem/Motivation

The current JS selector uses $(this).parents('.form-type-textarea').parent() to find the .limit-count-number element, but this fails with Drupal 10 markup where the textarea and counter are siblings inside .character-limited. As a result, the character count span’s ID is undefined and the count doesn’t update.

Proposed resolution

Change the JS selector to use $(this).closest('.character-limited').find('.limit-count-number') to correctly locate the counter span.

In addition, add translations in Twig template.

πŸ› Bug report
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain sergio.rizo

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

Comments & Activities

Production build 0.71.5 2024