Skip to content

Commit 4e993cf

Browse files
committed
MenubarSubmenu: update to address feedback for MenuContainerRole
1 parent 168a9e5 commit 4e993cf

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

client/components/Menubar/MenubarSubmenu.tsx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import {
1717
} from './contexts';
1818
import TriangleIcon from '../../images/down-filled-triangle.svg';
1919

20-
/** Custom subset of valid list item roles for the Menubar list items */
21-
export enum MenubarListItemRole {
20+
/** Custom subset of valid roles for the Menubar container */
21+
export enum MenuContainerRole {
2222
MENU = 'menu',
2323
LISTBOX = 'listbox'
2424
}
@@ -48,9 +48,8 @@ export function useMenuProps(id: string) {
4848

4949
/** Custom subset of valid values for aria-hasPopup for the MenubarTrigger */
5050
enum MenubarTriggerAriaHasPopup {
51-
MENU = MenubarListItemRole.MENU,
52-
LISTBOX = MenubarListItemRole.LISTBOX,
53-
TRUE = 'true'
51+
MENU = MenuContainerRole.MENU,
52+
LISTBOX = MenuContainerRole.LISTBOX
5453
}
5554

5655
interface MenubarTriggerProps
@@ -176,7 +175,7 @@ interface MenubarListProps {
176175
/** MenubarItems that should be rendered in the list */
177176
children?: React.ReactNode;
178177
/** The ARIA role of the list element */
179-
role?: MenubarListItemRole;
178+
role?: MenuContainerRole;
180179
}
181180

182181
/**
@@ -188,7 +187,7 @@ interface MenubarListProps {
188187
*/
189188
function MenubarList({
190189
children,
191-
role = MenubarListItemRole.MENU,
190+
role = MenuContainerRole.MENU,
192191
...props
193192
}: MenubarListProps) {
194193
const { id, title } = useContext(SubmenuContext);
@@ -230,7 +229,7 @@ export interface MenubarSubmenuProps {
230229
/** The ARIA role of the trigger button */
231230
triggerRole?: string;
232231
/** The ARIA role of the list element */
233-
listRole?: MenubarListItemRole;
232+
listRole?: MenuContainerRole;
234233
}
235234

236235
/**
@@ -251,7 +250,7 @@ export function MenubarSubmenu({
251250
id,
252251
title,
253252
triggerRole = 'menuitem',
254-
listRole = MenubarListItemRole.MENU,
253+
listRole = MenuContainerRole.MENU,
255254
...props
256255
}: MenubarSubmenuProps) {
257256
const { isOpen, handlers } = useMenuProps(id);
@@ -263,7 +262,7 @@ export function MenubarSubmenu({
263262
const listItemRef = useRef<HTMLLIElement | null>(null);
264263

265264
const hasPopup =
266-
listRole === MenubarListItemRole.LISTBOX
265+
listRole === MenuContainerRole.LISTBOX
267266
? MenubarTriggerAriaHasPopup.LISTBOX
268267
: MenubarTriggerAriaHasPopup.MENU;
269268

0 commit comments

Comments
 (0)