Skip to content

Commit 5e70c1d

Browse files
committed
menu: reintroduce desktop hover previews
Add visual previews for closed submenus on wide layouts with hover-capable pointers. This reintroduces desktop hover behavior without making hover the only way to reach submenu links. The CSS-only preview creates a semantic incongruence: while a closed category is hovered, its submenu is visible even though the native details state remains closed. Screen readers therefore continue to announce the category as collapsed during the preview. This tradeoff is acceptable because it applies only during committed, direct use of a mouse or another hover-capable pointer. The user must keep the pointer over the category to invoke the preview. Moving the pointer away removes it. Clicking a previewed category opens the native details element, aligns the visual and semantic states, and keeps the submenu visible after the pointer leaves. Keyboard and touch interactions do not trigger the preview. They continue to use the native disclosure behavior. No destination depends on hover. Suppress previews whenever any submenu is explicitly open so clicked and previewed menus cannot compete or overlap.
1 parent 2b84229 commit 5e70c1d

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

curl.css

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,23 @@ div.yellowbox {
647647
}
648648
}
649649

650+
@media screen and (min-width: 1001px) and (hover: hover) {
651+
/*
652+
* This CSS-only preview creates a semantic incongruence: a hovered submenu
653+
* is visible while <details> remains closed, so screen readers continue to
654+
* announce it as collapsed. The tradeoff applies only during committed,
655+
* direct use of a mouse or another hover-capable pointer. Moving the pointer
656+
* away removes the preview; clicking opens <details>, aligns the visual and
657+
* semantic states, and keeps the submenu visible. Keyboard and touch continue
658+
* to use native disclosure behavior. Suppress previews while any disclosure
659+
* is explicitly open.
660+
*/
661+
.sitenav-list:not(:has(.sitenav-disclosure[open]))
662+
.sitenav-disclosure:not([open]):hover::details-content {
663+
content-visibility: visible;
664+
}
665+
}
666+
650667
/* Final site-navigation breakpoint: the widest section menu needs this room. */
651668
@media screen and (max-width: 1000px) {
652669
.sitenav {

0 commit comments

Comments
 (0)