Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

menu/menubar should be allowed to be empty #3543

Closed
smhigley opened this issue Jul 13, 2022 · 5 comments
Closed

menu/menubar should be allowed to be empty #3543

smhigley opened this issue Jul 13, 2022 · 5 comments
Labels
fix Bug fixes pr A pr has been created for the issue rules Issue or false result from an axe-core rule wai-aria

Comments

@smhigley
Copy link
Contributor

smhigley commented Jul 13, 2022

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: #1444 (comment). 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... :D)

@WilcoFiers
Copy link
Contributor

Hey Sarah. Yeah I think in theory menus could be empty. Do you have any real-world example of this though? My reading of WAI-ARIA is that menus must contain at least one menuitem, or be set to aria-busy.

@smhigley
Copy link
Contributor Author

smhigley commented Jul 13, 2022

@WilcoFiers the specific use case that I ran into was with a menu that allows users to search/filter menuitems, and fails when a search string didn't match anything:

screenshot of a popup with the header "Actions", a searchbox with the string "test", and a menu below the searchbox with the static text "no actions found"

screenshot of the same Actions menu, but with an empty seachbox, and a list of commands below, including New, Rename, and Edit

@WilcoFiers
Copy link
Contributor

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.

@WilcoFiers WilcoFiers added fix Bug fixes wai-aria rules Issue or false result from an axe-core rule labels Jul 15, 2022
@smhigley
Copy link
Contributor Author

Thanks!

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

@WilcoFiers WilcoFiers added this to the axe-core 4.5.1 milestone Oct 19, 2022
@straker straker added the pr A pr has been created for the issue label Nov 3, 2022
@padmavemulapati
Copy link

Validated with the latest axe-core develop branch code base,
aria-required-children allowing menu and menubar to be empty.
test sript:

 <div role="menu" id="incomplete10"></div>
<div role="menubar" id="incomplete11"></div>
<div role="list" id="fail4">
  <div role="tabpanel" id="ignore6">
    <div role="listitem" id="ignore7">List item 1</div>
  </div>
</div>
<div role="row" id="fail5">
  <span>Item 1</span>
</div>
  <div role="row" id="target"></div>

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fixes pr A pr has been created for the issue rules Issue or false result from an axe-core rule wai-aria
Projects
None yet
Development

No branches or pull requests

4 participants