Problem Statement and existing understanding
I have a popup, which contains different kind of content separated into sections and is triggered on click of a button. I am trying to expose appropriate accessibility / aria semantics in this implementation. (It is not a modal dialog, but a simple in-place popup). As per my current research, this is what I think makes sense:
aria-expanded
on the trigger buttonaria-haspopup="menu"
on the trigger buttonrole="menu"
on the popuprole="menuitem"
on the content inside the popup- other optional keyboard accessibility
Examples:
- This menu button implementation example: https://www.w3.org/TR/wai-aria-practices/examples/menu-button/menu-button-links.html
- Twitter's implementation of similar popups with
role="menu"
- bootstrap's general guidelines around dropdowns https://getbootstrap.com/docs/4.0/components/dropdowns/#accessibility
The WAI ARIA standard defines an actual role="menu" widget, but this is specific to application-like menus which trigger actions or functions. ARIA menus can only contain menu items, checkbox menu items, radio button menu items, radio button groups, and sub-menus.
Bootstrap’s dropdowns, on the other hand, are designed to be generic and applicable to a variety of situations and markup structures. For instance, it is possible to create dropdowns that contain additional inputs and form controls, such as search fields or login forms. For this reason, Bootstrap does not expect (nor automatically add) any of the role and aria- attributes required for true ARIA menus. Authors will have to include these more specific attributes themselves.
My problem is kinda similar but I need some help in deciding the menuitem roles.
Requirement:
This is how my popup menu looks like:
- there are 2 sections separated by a divider
- the first section has some info and some interactive elements
- the second section has links
- for the second section, I am pretty much satisfied with using the
menuitem
role on each of them - I am not really sure about how to handle the first section though
- As per current understanding:
- anything wihtout the
menuitem
role inside amenu
, is ignored for creating the accessibility tree - any children of the
menuitem
have their semantics removed. So, abutton
inside amenuitem
would not be announced as such.
- anything wihtout the
- As with the twitter implementation, I can ignore my non interactive elements in the first section by NOT adding the
menuitem
role to them, but what should I do with the interactive elements. For example, for theFunds
item, I can't add arole="menuitem"
to the whole container, because then theAdd Funds
button would not work for screenreader users (?) . - I can may be add the
role="menuitem"
to the button, and make sure to add a better aria-label, which announces the current funds as well as allows user to click the button to add funds, but I am not really sure about this.
Questions:
- Are there any other ARIA roles / accessibility semantics that should be applied in this case? Is this use case a menu which fits in the definition of role="menu" ?
- If the role="menu" and role="menuitem" is most apt for this setup, what should I do with interactive elements in the first section of my component?
- If my requirement does not fit in any of the popup roles, is it ok to not expose this with a
aria-haspopup
and only with aria-expanded ?