Open primary nav mega menu on click instead of hover#51
Merged
Conversation
The "What we do" mega menu opened and closed on mouseenter/mouseleave. Moving the pointer from the nav link down into the panel crossed a gap where neither element was hovered, firing mouseleave and closing the menu out from under the visitor - reported as the menu "disappearing under the mouse entirely too often." The menu already had a working click-to-toggle handler alongside the hover handlers (plus outside-click and Escape to close), so the fix is to drop the two hover listeners and rely on click alone. No CSS changes needed: the mega panel is driven entirely by the `.is-open` class, with no hover-based display rule to fight. Verified via Chrome DevTools Protocol against the built site: a synthetic click opens the menu (aria-expanded=true), a synthetic mouseleave on both the trigger and the item no longer closes it, and a second click still toggles it closed. Signed-off-by: chellej <197998703+chellej@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mouseenter/mouseleave. Moving the pointer from the nav link down into the panel crosses a gap where neither element is hovered, firingmouseleaveand closing the menu out from under the visitor mid-interaction..is-openclass; there's no separate hover-based display rule to account for.Test plan
deno checkonsite/js/main.js- syntax validaria-expanded=true; a syntheticmouseleavedispatched on both the trigger and the nav item no longer closes it (previously would have); a second click still toggles it closed