Missing Drupal Behaviors for added content by formatters.

Created on 5 October 2022, about 2 years ago
Updated 9 October 2023, about 1 year ago

Problem/Motivation

When we use Colorbox Modal and Video (lazy load) formatters the rendered field content moves to the video-embed-field-modal. But when JS adds it to the page, it does not restart Drupal Behaviors for the added content.
This can potentially break the Drupal Behaviors of the other modules. For example Cookie Content Blocker or the custom one.

Steps to reproduce

1. Configure the video embed field with a simple Video formatter
2. To avoid looking for a module that can make JS changes to the field, create a test library that makes some minimal changes to the field content. For example, adds a class.
3. Check if your test code is working
4. Change the Video formatter to Colorbox Modal or Video (lazy load) formatter.
5. Check if your test code is still working

Proposed resolution

Reattach Drupal Behaviors after adding content to the page.

🐛 Bug report
Status

Needs review

Version

2.0

Component

Video Embed Field (base module)

Created by

🇺🇦Ukraine HitchShock Ukraine

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.

  • First commit to issue fork.
  • @reszli opened merge request.
  • 🇷🇴Romania reszli Târgu Mureș

    created an MR with the changes, also getting rid of the jquery/once in favour of core/once

Production build 0.71.5 2024