Problem/Motivation

Underscore.js library was deprecated in Drupal 9.4 (https://www.drupal.org/node/3273118)
But it is used in following files: attributes.js, drupal.bootstrap.js, modal.js

This causes unpredictable JS errors under Drupal 10.

Proposed resolution

There is a quick fix for this issue: library still present in Drupal 10 core but was renamed to 'core/internal.underscore'.

I've added merge request to add this library as dependency for mentioned files and this solves a problem for Drupal 10.0.x.

This is safe for both Drupal 10 and Drupal 9.5 because it was deprecated in Drupal 9.4. So Drupal 9.5 (which is requirement since 3.27) has Underscore.js library defined as both 'core/underscore' and 'core/internal.underscore'.

P.S.: Created separate Issue #3343712 to discuss a long term solution.

CommentFileSizeAuthor
#9 underscore-3343708-9.patch1.2 KBchris matthews

Issue fork bootstrap-3343708

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

f1mishutka created an issue. See original summary.

f1mishutka’s picture

Issue summary: View changes

f1mishutka’s picture

Issue summary: View changes
f1mishutka’s picture

Assigned: f1mishutka » Unassigned
Priority: Normal » Major
Status: Active » Needs review

Changed priority to Major because this could be show stopper for projects under Drupal 10

f1mishutka’s picture

Title: Underscore.js library is deprecated under Drupal 10 » Underscore.js library is deprecated under Drupal 10, quick dependencies fix
f1mishutka’s picture

chris matthews’s picture

Status: Needs review » Reviewed & tested by the community

Manually tested the patch generated from the merge request and it provides a temporary fix for this issue so taking the liberty to mark as RTBC. @shelane @wundo, would you be able to commit merge request !23 and ideally tag a new 8.x-3.28 release?

chris matthews’s picture

StatusFileSize
new1.2 KB

Here is a patch that includes jquery dependency updates as well:


THIS

 modal.jquery.ui.bridge:
     js/modal.jquery.ui.bridge.js: {}
   dependencies:
       - bootstrap/modal
       - core/jquery.ui
       - core/jquery.ui.widget
       - core/jquery.ui.draggable
       - core/jquery.ui.mouse
       - core/jquery.ui.position
       - core/jquery.ui.resizable

TO THIS

 modal.jquery.ui.bridge:
     js/modal.jquery.ui.bridge.js: {}
   dependencies:
       - jquery_ui/jquery_ui
       - jquery_ui_draggable/jquery_ui_draggable
       - jquery_ui_resizable/jquery_ui_resizable

For reference: https://www.drupal.org/node/3067969

shelane’s picture

I will need to update dependencies in composer and do a hook to make sure those dependencies are enabled.

f1mishutka’s picture

As I understand jQuery UI stays in Drupal 10 core. So there is no need to rely on jquery_ui module.
So there is no need for second patch with `core/jquery.ui` replaced to `jquery_ui/jquery_ui`

We are running bootstrap theme under Drupal 10 for two month already with just patch from merge request with no issues at all.

My proposal is to merge it as simple as it is in merge request. This is enough quick-fix for people can use it already under Drupal 10 without patches) and then concentrate efforts on issue #3343712 as a long-term solution for Drupal 10.1+

chris matthews’s picture

Yeah, I do agree @f1mishutka. Good call.

  • shelane committed 30cd4db2 on 8.x-3.x authored by f1mishutka
    Issue #3343708 by f1mishutka, Chris Matthews: Underscore.js library is...

shelane credited _doyle_.

shelane’s picture

shelane’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.