Skip to content

Commit f5a4195

Browse files
authored
docs(aria/menu): fix menubar example highlight styling (#33290)
Highlight menubar items only while interacting, using :hover, :focus-within, and [aria-expanded='true'] for the open submenu state. Items inside an open menu keep their [data-active] highlight.
1 parent 40b63f3 commit f5a4195

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

src/components-examples/aria/menu/menu-example.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@
7777

7878
.example-menu-trigger:hover,
7979
.example-menu-item[data-active='true'],
80-
.example-menu-bar-item[data-active='true'] {
80+
.example-menu-bar-item:hover,
81+
.example-menu-bar-item:focus-within,
82+
.example-menu-bar-item[aria-expanded='true'] {
8183
background: color-mix(
8284
in srgb,
8385
var(--mat-sys-on-surface) calc(var(--mat-sys-hover-state-layer-opacity) * 100%),

src/components-examples/aria/menubar/menubar.css

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,13 @@
4747
opacity: 0.5;
4848
}
4949

50-
[ngMenuItem][data-active='true'] {
50+
[ngMenu] [ngMenuItem][data-active='true'] {
51+
background: color-mix(in srgb, var(--mat-sys-outline) 20%, transparent);
52+
}
53+
54+
[ngMenuBar] > [ngMenuItem]:hover,
55+
[ngMenuBar] > [ngMenuItem]:focus-within,
56+
[ngMenuBar] > [ngMenuItem][aria-expanded='true'] {
5157
background: color-mix(in srgb, var(--mat-sys-outline) 20%, transparent);
5258
}
5359

0 commit comments

Comments
 (0)