Different asset libraries must not use the same files (dialog & autocomplete)

Created on 14 September 2023, 12 months ago

Problem/Motivation

Drupal can track asset libraries included on a page, but it does not track single files included by libraries on a page. Therefore different asset libraries must never use the same file. If they do so, the ordering of asset files through weight, SMACSS layer and dependencies is bypassed.

Currently drupal.dialog and drupal.autocomplete declare the same files. This causes ordering issues, especially with CSS, where the ordering of files is used for overruling styles.

Steps to reproduce

  1. A page loads with drupal.dialog included
  2. a 3rd party library depends or overrules on drupal.dialog library (e.g. Gin admin theme has a CSS file that overrules parts of assets/vendor/jquery.ui/themes/base/core.css)
  3. An ajax request triggers the injection drupal.autocomplete
  4. Some of the files already including in drupal.dialog are now added once again through drupal.autocomplete, but this time at the very end of the HTML < head >
  5. All the rules overwritten by from Gin are now gone, because autocomplete added the same assets/vendor/jquery.ui/themes/base/core.css again, but AFTER the Gin file.

Proposed resolution

Refactor drupal.dialog and drupal.autocomplete into three libraries: Move all shared files from autocomplete and dialog into a new library drupal.jqueryui-shared and depend on the new library. This way ordering will remain intact, even if one of the libraries is added later on though Ajax.

🐛 Bug report
Status

Closed: duplicate

Version

11.0 🔥

Component
Javascript 

Last updated 1 day ago

Created by

🇦🇹Austria hudri Austria

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

Comments & Activities

Production build 0.71.5 2024