Improved Drupal\Core\Ajax\AddCssCommand causes change in CSS load order.

Created on 25 October 2023, about 1 year ago
Updated 8 May 2024, 6 months ago

Problem/Motivation

Since the introduction of the improved Drupal\Core\Ajax\AddCssCommand, CSS files gets appended inside the head instead of prepended. This breaks CSS styles.

Steps to reproduce

Trigger an event that calls `AddCssCommand` and take a look at the head.

Proposed resolution

Override the default loadjs injection to prepend CSS link elements in stead of appending (see patch)
In an ideal world, the CSS should keep the CSS 'weights' in account, so CSS component fileshould not be loaded afther a CSS theme file.

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Ajax 

Last updated about 5 hours ago

Created by

🇧🇪Belgium al0a

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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.

Production build 0.71.5 2024