Skip to content

Refactor the ARIA structure of the flyout #9495

Closed

Description

@gonfunko

The flyout's ARIA structure should be updated as follows:

  • The flyout's role should become menu
  • Labels should have their role set to heading
  • Each set of items between a label should be wrapped in an element with role group
  • All other flyout items should have their role set to menuitem

Activity

  1. added theissue type on Dec 2, 2025
  2. BenHenning commented on Dec 3, 2025

    @BenHenning
    Contributor

    One open question I had is whether the readout will work correctly if there are no headings present, but looking into https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/menu_role I'm actually questioning the opposite: it doesn't seem standard to include headings within menus. It might be worth trying to find a standard HTML example of this that we can look at with a screen reader in order to see how it behaves in order to replicate it.

  3. microbit-robert commented on Dec 5, 2025

    @microbit-robert
    Collaborator

    Chakra UI is good for accessible components and they have a menu example with groups and headings, but I must admit I've not tried to find other examples yet. It is also currently unclear to me whether groups of menuitems must have headings or not.

    FYI, I very briefly tried switching the flyout to a menu from a tree and this seemed to break VoiceOver when navigating to the toolbox. I didn't get the bottom of what was happening, but presume the accessibility tree was broken by this change in some way.

  4. self-assigned this
    on Dec 11, 2025
  5. moved this from Todo to In Progress in Blocklyon Dec 15, 2025
  6. added a commit that references this issue on Dec 15, 2025
    bb342f9
  7. BenHenning commented on Apr 14, 2026

    @BenHenning
    Contributor

    Chakra UI is good for accessible components and they have a menu example with groups and headings, but I must admit I've not tried to find other examples yet. It is also currently unclear to me whether groups of menuitems must have headings or not.

    FYI, I very briefly tried switching the flyout to a menu from a tree and this seemed to break VoiceOver when navigating to the toolbox. I didn't get the bottom of what was happening, but presume the accessibility tree was broken by this change in some way.

    I took a deeper look at the node tree from the Chakra UI example. It's interesting because they aren't actually following the spec per MDN (https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/menu_role). My read of the spec is that menus are supposed to have exactly group and menuitem children. They do follow that except for headings which are just standard divs with text (and are thus interpreted as static text in the node tree). I want to note these are not actual real headings in the ARIA heading role sense, and I'm not sure those would actually behave correctly.

    I'm not sure we actually want to follow this pattern. While menu is nice, it also doesn't quite perfectly match what a Flyout is. My understanding is that menus are supposed to specifically be pop-up UI experiences (https://www.w3.org/WAI/ARIA/apg/patterns/menubar/) which the Flyout isn't quite. Now I'm not necessarily sure that list is any better but that actually does more correctly support headings as far as I can tell.

    We don't really get any particular benefits for lists in terms of automatic modes, though, since we're overriding all screen reader interactions by using the root injection dev application role.

    Do you have any thoughts on this @microbit-robert?

  8. microbit-robert commented on Apr 14, 2026

    @microbit-robert
    Collaborator

    @BenHenning I don't currently have a good handle on this, and also don't know what the 'correct' solution is, perhaps there isn't one.

    The magical combination would be a suitable role for the flyout and flyout items that would also, while having a screen reader running, naturally support the up/down arrows without having role="application". This would allow screen reader key's such as 'h' to move to the next heading. I'm really not sure such a role exists though.

    I think the list role works reasonably well as is. Regardless, these are two key things we want to keep in terms of screen reader output:

    • the total number of items in the flyout
    • the position of the currently focused flyout item (e.g., 4 of 10)

    Things proven to be confusing:

    • differentiating headings from blocks (if this can be addressed then I think the current implementation works well, even if it's not exactly inline with the spec)
      • buttons maybe fall into this category as well, but this is unclear as we've not tested things like creating a variable with screen reader users

    I'm also not sure if grouping items with a heading improves anything in terms of screen reader support or just makes things more complicated.

  9. BenHenning commented on Apr 14, 2026

    @BenHenning
    Contributor

    Got it, thanks @microbit-robert. At this stage it does seem better to avoid menu just because it doesn't really fit what we ultimately want.

    The rest I definitely agree with. To some extent we're really just shoehorning in properties to try and get the behavior we want, so it might be a bit finicky (it seems completely broken for me in the current keyboard nav plugin demo deployment with ChromeVox, for example). I think we have a solid idea as to what we want the end behavior to be, but it does seem unclear exactly how to get there. It probably makes sense to continue with the list approach and try to tweak it to better fit the end experience that you describe here.

  10. moved this from In Progress to Done in Blocklyon Apr 29, 2026
  11. closed this as completedby moving to Done in Blocklyon Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions