Mautic 7.2.1 upgrade can leave stale libraries.css, causing dropdown layout regressions
Mautic Series
7.2.x series
Mautic installed version
7.2.1
Way of installing
I installed with composer using https://github.com/mautic/recommended-project
PHP version
8.5
What browsers are you seeing the problem on?
Not relevant
What happened?
Title
Mautic 7.2.1 upgrade can leave stale libraries.css, causing dropdown layout regressions
Description
After upgrading from Mautic 7.1.3 to 7.2.1, the admin UI showed broken dropdown/menu styling.
The issue was caused by an old generated docroot/media/css/libraries.css remaining in place after the upgrade.
The stale file still contained Bootstrap rules such as:
.dropdown-menu > li > a {
display: block;
}This overrides the new Mautic 7.2.1 dropdown styling:
.dropdown-menu > li > a {
display: inline-flex;
}Both selectors have the same specificity, so the later loaded libraries.css wins.
Environment
- Upgrade: Mautic 7.1.3 → 7.2.1
- PHP 8.5
- Composer installation using
mautic/recommended-project - Production environment
Steps to reproduce
- Upgrade an existing Mautic 7.1.3 Composer installation to 7.2.1.
- Run the normal asset build:
php bin/console mautic:assets:generate- Open an admin dropdown menu.
Actual result
Dropdowns are visually broken.
DevTools shows:
display: blockfor .dropdown-menu > li > a, coming from docroot/media/css/libraries.css.
Before a clean rebuild, the generated file was approximately:
docroot/media/css/libraries.css 460 KBExpected result
After upgrading and running mautic:assets:generate, obsolete generated CSS from previous Mautic versions should not remain and influence the new UI.
Workaround / finding
Deleting the generated assets before rebuilding resolves the problem:
rm -rf node_modules
rm -rf var/sass/*
rm -rf docroot/assets/*
rm -f docroot/media/css/app.css
rm -f docroot/media/css/libraries.css
rm -f docroot/media/css/offline.css
rm -f docroot/media/js/app.js
rm -f docroot/media/js/libraries.js
npm ci
php bin/console mautic:assets:generateAfter the clean build:
var/sass/app.output.css ~907 KB
docroot/media/css/app.css ~63 KB
docroot/media/css/libraries.css 0 BThe stale Bootstrap CSS is gone and no longer overrides the new Mautic 7.2.1 dropdown rules.
Suggested fix
mautic:assets:generate should ensure that obsolete production asset files are removed or recreated during upgrades, especially docroot/media/css/libraries.css, even if the new build no longer contains files for that asset group.
How can we reproduce this issue?
Step 1: Upgrade an old Mautic version with composer to 7.2.1. Mine was 7.1.3 before upgrading. Step 2: Check UI.
Relevant log output
Code of Conduct
- I confirm that I have read and agree to follow this project's Code of Conduct
Care about this issue? Want to get it resolved sooner? If you are a member of Mautic, you can add some funds to the Bounties Project so that the person who completes this task can claim those funds once it is merged by a member of the core team! Read the docs here.
Source: mautic/mautic