From 9d4cebca0e4667463cb377d7b3ac57d94b81cd1a Mon Sep 17 00:00:00 2001 From: Robin Date: Thu, 14 Aug 2025 13:49:19 +0200 Subject: [PATCH 1/2] Improve accessibility of toggle and checkbox menu items MenuItems can be used either inside a Menu component (which creates a roving tab index) or simply with an element of role menu. In the latter case, focus would previously land on the cosmetic element, which is a bad idea as it's hidden from accessibility technologies. By turning the parent
into a `; diff --git a/src/components/Menu/__snapshots__/ToggleMenuItem.test.tsx.snap b/src/components/Menu/__snapshots__/ToggleMenuItem.test.tsx.snap index 9b3b59f0..142866a8 100644 --- a/src/components/Menu/__snapshots__/ToggleMenuItem.test.tsx.snap +++ b/src/components/Menu/__snapshots__/ToggleMenuItem.test.tsx.snap @@ -2,7 +2,7 @@ exports[`ToggleMenuItem > renders 1`] = ` -
renders 1`] = ` class="_input_d9763f" id="«r0»" role="switch" + tabindex="-1" type="checkbox" />
-
+
`; From bec2645d05fda676b2e3f3954b01873a942ba4a0 Mon Sep 17 00:00:00 2001 From: Robin Date: Thu, 14 Aug 2025 15:06:26 +0200 Subject: [PATCH 2/2] Add menu role to menu containers in stories --- src/components/Menu/CheckboxMenuItem.stories.tsx | 2 +- src/components/Menu/ToggleMenuItem.stories.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Menu/CheckboxMenuItem.stories.tsx b/src/components/Menu/CheckboxMenuItem.stories.tsx index 9cd715f1..205295c6 100644 --- a/src/components/Menu/CheckboxMenuItem.stories.tsx +++ b/src/components/Menu/CheckboxMenuItem.stories.tsx @@ -17,7 +17,7 @@ type Props = Omit< const Template: React.FC = (props: Props) => { const [firstChecked, setFirstChecked] = useState(false); return ( -
+
= (props: Props) => { const [firstChecked, setFirstChecked] = useState(false); return ( -
+