Drupal behaviors not attached after ajax content is loaded

Created on 13 February 2023, almost 2 years ago

Problem/Motivation

We're having an issue with ajax loaded content.
The content being loaded is not being considered by Drupal JS behaviors.
We see this issue e.g. when using the extlink module β†’ , which doesn't apply the external link icon, when it should.

Proposed resolution

It seems behaviors will be attached only when executing Drupal ajax calls, which is not the case here (see https://drupal.stackexchange.com/questions/270639/drupal-behaviors-not-a...).

My proposed resolution is to add Drupal.attachBehaviors(); after the content has been added to the DOM.

✨ Feature request
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium ludo.r Brussels

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

Comments & Activities

Production build 0.71.5 2024