Skip to content

Scope dropdown multi-column CSS to navigation menus#792

Merged
jjroelofs merged 1 commit into8.xfrom
Jur/8.x/#791-fix-dropdown-css-scoping-leak
Mar 31, 2026
Merged

Scope dropdown multi-column CSS to navigation menus#792
jjroelofs merged 1 commit into8.xfrom
Jur/8.x/#791-fix-dropdown-css-scoping-leak

Conversation

@jjroelofs
Copy link
Copy Markdown
Collaborator

Linked issues

Solution

The multi-column dropdown layout rule in scss/vendor-extensions/bootstrap-5.scss used .dropdown-menu:not(.dropdown-full-width .dropdown-menu) nested under .html, making it effectively global. This applied float: left, display: block, and min-width to <li> elements inside every Bootstrap .dropdown-menu on the page — including dropdowns from third-party modules and non-navigation components.

Fixed by scoping the selector to .nav .dropdown-menu:not(...), restricting it to Bootstrap navigation contexts. This is consistent with:

  • enhanced-dropdowns.js initAutoColumns() which targets .navbar-nav > .nav-item.dropdown > .dropdown-menu
  • dxpr-theme-header--top.scss which scopes its dropdown rules under .block-system-menu-blockmain

Checklist

  • I have read the CONTRIBUTING.md document.
  • My commit messages follow the contributing standards and style of this project.
  • My code follows the coding standards and style of this project.
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Need to run update.php after code changes
  • Requires a change to end-user documentation.
  • Requires a change to developer documentation.
  • Requires a change to QA tests.
  • Requires a new QA test.
  • I have updated the documentation accordingly.
  • All new and existing tests passed.

The `.dropdown-menu:not(.dropdown-full-width .dropdown-menu) li` rule
was nested under `.html` which is on the root <html> element, making it
effectively global. This applied float:left, display:block, and
min-width to <li> elements inside every Bootstrap dropdown on the page,
breaking non-navigation dropdowns from other software components.

Scope the selector to `.nav .dropdown-menu` to match only navigation
context dropdowns, consistent with the enhanced-dropdowns.js
initAutoColumns() which targets `.navbar-nav > .nav-item.dropdown >
.dropdown-menu`.

Fixes: #791
@jjroelofs jjroelofs merged commit 26d0419 into 8.x Mar 31, 2026
1 of 3 checks passed
@jjroelofs jjroelofs deleted the Jur/8.x/#791-fix-dropdown-css-scoping-leak branch March 31, 2026 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant