Add jQuery and dependency verification checks to EU Cookie Compliance JavaScript behaviors

Created on 31 March 2025, 7 days ago

Problem/Motivation

JavaScript behaviours in EU Cookie Compliance Rocketship fail in certain contexts like Layout Builder because it doesn't verify the availability of required dependencies (jQuery, once) before execution. This results in errors like Uncaught TypeError: jQuery is not a function or once is not defined.

Steps to reproduce

Install EU Cookie Compliance Rocketship module and Section library for example ( https://www.drupal.org/project/section_library )
Navigate to Layout Builder interface (/node/{node_id}/layout)
Save current section in a section library
Open browser console
Observe dependency-related errors

Proposed resolution

Add dependency verification checks at the start of behavior attachment

Remaining tasks

Add dependency checks to all EU Cookie Compliance JavaScript behaviors
Test in various contexts (Layout Builder, AJAX, etc.)
Update documentation

User interface changes

No UI changes required. This is a JavaScript stability improvement.

API changes

No API changes required. This is a JavaScript stability improvement.

Data model changes

🐛 Bug report
Status

Active

Version

2.1

Component

Code

Created by

🇵🇱Poland jorgik

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