Skip to content

Guidelines for complex widget with nested interactions #1285

Closed
@gaurav5430

Description

@gaurav5430

HTML does not allow nested interactive elements.
I have seen a similar discussion here, which discusses how nested interactive roles are a problem for screenreader users.

I would like to understand how to go about creating a widget which has nested interactive elements. Since semantic HTML can't be used to create these nested interactions, how would we expose the correct ARIA roles so that it is still screenreader and keyboard friendly.

Some examples:
Screenshot 2020-06-07 at 12 53 51 AM
The above image shows a widget used by gmail. The widget is interactive as a whole, but once you hover on it, an overflow menu is also available which is also interactive.

The overflow menu is created using a div, the trigger for this overflow menu has aria-popup.
The widget is created using a div, which passes on the keyboard interactions to the underlying link, and once the focus is on this widget, user can press tab to focus the overflow menu.

I would like to understand if there are some guidelines for nested interactivity in ARIA, with or without a dependency on semantic HTML.

Is it fine to have nested interactive elements as long as it is valid HTML/valid aria structure?
so button inside button or role="button" inside role="button" wouldn't be allowed, but if we just replace it with div inside div (and take care of the keyboard interactions) it would be fine ?

If nested interactions are not a problem as such, any pointers to why they are not allowed in HTML?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions