JS error when js-is-auto does not exist

Created on 13 November 2024, about 1 month ago

Problem/Motivation

We get this JS error when using the footnotes_group block:

Uncaught TypeError: footnote.querySelector(...) is null
    attach http://mnhn.drupal9-mnhn.docksal.site/modules/contrib/footnotes/assets/js/footnotes.group_block.js?v=10.3.5:67
    attach http://mnhn.drupal9-mnhn.docksal.site/modules/contrib/footnotes/assets/js/footnotes.group_block.js?v=10.3.5:54
    attachBehaviors http://mnhn.drupal9-mnhn.docksal.site/core/misc/drupal.js?v=10.3.5:166
    attachBehaviors http://mnhn.drupal9-mnhn.docksal.site/core/misc/drupal.js?v=10.3.5:162
    <anonymous> http://mnhn.drupal9-mnhn.docksal.site/core/misc/drupal.init.js?v=10.3.5:32
    listener http://mnhn.drupal9-mnhn.docksal.site/core/misc/drupal.init.js?v=10.3.5:20
    domReady http://mnhn.drupal9-mnhn.docksal.site/core/misc/drupal.init.js?v=10.3.5:26
    <anonymous> http://mnhn.drupal9-mnhn.docksal.site/core/misc/drupal.init.js?v=10.3.5:31
    <anonymous> http://mnhn.drupal9-mnhn.docksal.site/core/misc/drupal.init.js?v=10.3.5:34
footnotes.group_block.js:67:20

Steps to reproduce

Create a footnotes_group and enable the "Group footnotes using JavaScript" option.
Insert a footnote with an explicit footnote value (no auto numbering).

Proposed resolution

Drupal.behaviors.footnotesGroup.attach() should check if footnote.querySelector('.js-is-auto') returns something before trying to use it.

🐛 Bug report
Status

Active

Version

4.0

Component

Footnotes

Created by

🇫🇷France prudloff Lille

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024