Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions docs/data/material/components/menus/GroupedMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,18 @@ import Menu from '@mui/material/Menu';
import MenuItem from '@mui/material/MenuItem';
import { styled } from '@mui/material/styles';

const StyledListHeader = styled(ListSubheader)({
backgroundImage: 'var(--Paper-overlay)',
});
const StyledListHeader = Object.assign(
styled(ListSubheader)({
backgroundImage: 'var(--Paper-overlay)',
}),
{
// IMPORTANT: The base ListSubheader component sets `muiSkipListHighlight = true`
// by default, but wrapping it with `styled(ListSubheader)` does not preserve
// that static field. We re-declare it here so the menu list continues to skip
// highlighting this non-focusable subheader when navigating with the keyboard.
muiSkipListHighlight: true,
},
);

export default function GroupedMenu() {
const [anchorEl, setAnchorEl] = React.useState(null);
Expand Down
15 changes: 12 additions & 3 deletions docs/data/material/components/menus/GroupedMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,18 @@ import Menu from '@mui/material/Menu';
import MenuItem from '@mui/material/MenuItem';
import { styled } from '@mui/material/styles';

const StyledListHeader = styled(ListSubheader)({
backgroundImage: 'var(--Paper-overlay)',
});
const StyledListHeader = Object.assign(
styled(ListSubheader)({
backgroundImage: 'var(--Paper-overlay)',
}),
{
// IMPORTANT: The base ListSubheader component sets `muiSkipListHighlight = true`
// by default, but wrapping it with `styled(ListSubheader)` does not preserve
// that static field. We re-declare it here so the menu list continues to skip
// highlighting this non-focusable subheader when navigating with the keyboard.
muiSkipListHighlight: true,
},
);

export default function GroupedMenu() {
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
Expand Down
Loading