@@ -25,18 +25,21 @@ const MenuExample: StoryFn<typeof Menu> = (args) => (
2525
2626export const Default = MenuExample . bind ( { } ) ;
2727Default . args = {
28+ role : "menu" ,
2829 children : (
2930 < >
3031 { ContentMenuStory . args . children }
31- < MenuDivider title = "Second menu part" />
32+ < MenuDivider role = "separator" title = "Second menu part" />
3233 < MenuItem { ...MenuItemStory . args } active />
3334 </ >
3435 ) ,
3536} ;
3637
3738/**
3839 * Use `role="navigation"` for a list of links, e.g. as main or sidebar navigation.
39- * The `MenuItem` elements get `roleStructure="listitem"` automatically.
40+ * The `MenuItem` elements need `roleStructure="listitem"`, it is set automatically if missing.
41+ * `MenuDivider` elements need `role="listitem"` because `separator` is not allowed inside a list,
42+ * it is set automatically if missing. Dividers without `title` get `aria-hidden` automatically.
4043 * `Menu` does not add a `nav` element, so you need to wrap it on your own.
4144 */
4245const NavigationExample : StoryFn < typeof Menu > = ( args ) => (
@@ -51,9 +54,18 @@ export const Navigation = NavigationExample.bind({});
5154Navigation . args = {
5255 role : "navigation" ,
5356 children : [
54- < MenuItem key = "1" text = "Dashboard" icon = "application-homepage" href = "#dashboard" active aria-current = "page" /> ,
55- < MenuItem key = "2" text = "Projects" icon = "artefact-project" href = "#projects" /> ,
56- < MenuItem key = "3" text = "Datasets" icon = "artefact-dataset" href = "#datasets" /> ,
57- < MenuItem key = "4" text = "Settings" icon = "application-useraccount" href = "#settings" /> ,
57+ < MenuItem
58+ key = "1"
59+ roleStructure = "listitem"
60+ text = "Dashboard"
61+ icon = "application-homepage"
62+ href = "#dashboard"
63+ active
64+ aria-current = "page"
65+ /> ,
66+ < MenuItem key = "2" roleStructure = "listitem" text = "Projects" icon = "artefact-project" href = "#projects" /> ,
67+ < MenuItem key = "3" roleStructure = "listitem" text = "Datasets" icon = "artefact-dataset" href = "#datasets" /> ,
68+ < MenuDivider key = "d1" role = "listitem" /> ,
69+ < MenuItem key = "4" roleStructure = "listitem" text = "Settings" icon = "application-useraccount" href = "#settings" /> ,
5870 ] ,
5971} ;
0 commit comments