question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

menu/menubar should be allowed to be empty

See original GitHub issue

Related to #383 and #1444

This is a very similar issue to the ones about aria-required-children on list, listbox, and tree. I can’t think of a reason why menu and menubar should not be allowed to be empty as well. Two scenarios where this might happen include:

  • A menu’s commands are loaded dynamically when it is opened, and it does not contain menuitems when in the loading state
  • There is a way to filter commands in a menu, and the user types in a string that does not match any menuitems. (This is the scenario where I’m currently running into the issue)

I generally think the aria-required-children rule makes more sense as an allowed children check across all roles where it applies, as @WilcoFiers mentioned in this comment: https://github.com/dequelabs/axe-core/issues/1444#issuecomment-476868942. The comment further down notes that only menu, menubar, and row would continue to fail when empty. I understand row, but I couldn’t find any reason stated in that thread why menu/menubar would require children, and I can’t personally think of a reason why those would be exceptions.

This is related to the ARIA changes in #1454, but I don’t think updating menu/menubar to match list, listbox, tree, etc. would need to wait on the ARIA PR (speaking of which, going to go update that now… 😄)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
smhigleycommented, Jul 15, 2022

Thanks!

And yup, This prompted me to finally go back and update my allowed-children PR (https://github.com/w3c/aria/pull/1454). That should fix this on the ARIA spec side of things 😄.

1reaction
WilcoFierscommented, Jul 15, 2022

Fair enough! I’ll see what we can do. You may also want to raise this with ARIA as well, since this doesn’t seem valid as per Required owned elements:

https://www.w3.org/TR/wai-aria-1.2/#mustContain 5.2.6 Required Owned Elements Any element that will be owned by the element with this role. For example, an element with the role list will own at least one element with the role listitem.

When multiple roles are specified as required owned elements for a role, at least one instance of one required owned element is expected. This specification does not require an instance of each of the listed owned roles. For example, a menu should have at least one instance of a menuitem, menuitemcheckbox, or menuitemradio. The menu role does not require one instance of each.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Aria listbox and list roles should be allowed to be empty #383
This example page shows multiple listboxes, some of which are empty https://www.w3.org/TR/wai-aria-practices/examples/listbox/listbox.html.
Read more >
Main menubar does not show up Tkinter - Stack Overflow
You are creating an empty menubar. If you want your file and edit menus to appear, you must add them to the menubar:...
Read more >
Primefaces Menu, MenuBar, MenuButton, TieredMenu ...
This tutorial will cover the following types of menu: Menu: Is a navigation component with submenus and menu items. MenuBar: Is a horizontal ......
Read more >
Menu/MenuBar Object - Methods & Properties | AutoHotkey v2
The Menu/MenuBar object provides an interface for menus or menu bars to ... If empty or omitted, MenuItemName will be converted into a...
Read more >
How to Use Menus - Creating a GUI With Swing
A popup menu is a menu that is invisible until the user makes a platform-specific mouse action, such as pressing the right mouse...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found