Problem/Motivation

The dropdown has an extra hover-based behavior applied via the CSS rule:

.dropdown:hover > .dropdown-menu {
  display: block;
}

This duplicates the default click-based behavior. As a result, the dropdown opens both on hover and on click, which leads to inconsistent and glitchy UI interaction.

Steps to reproduce

1. Place a dropdown (e.g., language selector) in the header.
2. Move the cursor over it: the menu opens.
3. Click the dropdown toggle: the menu state conflicts with the hover behavior and does not collapse reliably.

Proposed resolution

Remove the hover-based rule to ensure the dropdown state is controlled only by click. This restores the expected Bootstrap/standard dropdown behavior.

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

kir lazur created an issue. See original summary.

kir lazur’s picture

Issue summary: View changes
murz’s picture

Status: Active » Reviewed & tested by the community

Faced this bug too, when we add any Bootstrap Dropdown to the page, it starts to behave wrong: instead of "onclick" it opens on the hover, because of this CSS override. The MR fixes the issue well, so marking as RTBC.

By the way, we also have this CSS, related to dropdowns above the removed rules:

.header-style-3 .dropdown > .dropdown-menu {
  display: block;
}

Do we really need it? I think it's better to keep the default Bootstrap Dropdown behavior, and use Bootstrap-related classes in Twig, instead of overriding the behavior by CSS.

murz’s picture

Title: Dropdown menu hover » Bootstrap Dropdown in the header opens on hover instead of click
murz’s picture

@anoopsingh92, could you please review and merge this fix? It breaks all the Bootstrap dropdowns in the header :(

anoopsingh92 made their first commit to this issue’s fork.

anoopsingh92’s picture

Status: Reviewed & tested by the community » Fixed

Merged, Thank you!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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