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

Fix the usage of aria-haspopup #24796

Closed
afercia opened this issue Aug 25, 2020 · 5 comments
Closed

Fix the usage of aria-haspopup #24796

afercia opened this issue Aug 25, 2020 · 5 comments
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@afercia
Copy link
Contributor

afercia commented Aug 25, 2020

Describe the bug

The ARIA attribute aria-haspopup is used inconsistently across the Gutenberg UI. For example, some buttons that open a menu do use aria-haspopup, while others don't.

It is worth reminding that aria-haspopup changed between the ARIA 1.0 and 1.1 specifications.

In ARIA 1.0: https://www.w3.org/TR/wai-aria-1.0/states_and_properties#aria-haspopup

Indicates that the element has a popup context menu or sub-level menu.
This means that activation (note by me: this means activation by the user) renders conditional content. Note that ordinary tooltips are not considered popups in this context.
A popup is generally presented visually as a group of items that appears to be on top of the main page content.

In ARIA 1.1 it has been expanded to indicate opening of other patterns that aren't just menus: https://www.w3.org/TR/wai-aria-1.1/#aria-haspopup

Where the allowed values are:

false (default)	Indicates the element does not have a popup.
true            Indicates the popup is a menu.
menu            Indicates the popup is a menu.
listbox         Indicates the popup is a listbox.
tree            Indicates the popup is a tree.
grid            Indicates the popup is a grid.
dialog          Indicates the popup is a dialog.

It is clear that the concept of "popup" evolved to represent other kind of UIs.

Regardless, right now in Gutenberg there's the need to consistently communicate to assistive technology users whether a UI control opens some kind of additional UI. Worth noting that aria-expanded alone isn't sufficient because it represents a state, while aria-haspopup is a property.

Examples:
In the block toolbars, some buttons that open a menu do use aria-haspopup, for example:

  • the block switcher button
  • the text alignment button

Other buttons that open a menu don't use aria-haspopup, for example:

  • the "Replace" button in the Image block

Screenshots:

Screenshot 2020-08-25 at 12 47 54

Screenshot 2020-08-25 at 12 48 08

Screenshot 2020-08-25 at 12 48 24

There's also the case of a button that uses aria-haspopup but it opens... another toolbar. Semantically, this isn't correct and it can be confusing for users. I'll split this in a separate ticket. See the Heading block, where the "Change heading level" button opens another toolbar:

aria-haspopup for a toolbar

Screenshot 2020-08-25 at 16 52 04

Lastly, there are cases where a button opens a complex UI that is made of various parts. I'm not sure which of the aria-haspopup values would be the most appropriate in these cases. This would need some research and discussion. For example, see the case of the "Quick inserter" or the “Content structure” UIs. How can we properly communicate what kind of UI is going to be opened? At a first glance, the closest value might be "dialog" but this UIs aren't real ARIA dialogs.

Screenshot 2020-08-25 at 15 58 18

@tellyworth
Copy link
Contributor

At a first glance, the closest value might be "dialog" but this UIs aren't real ARIA dialogs.

If we were to pick a value to start with that's better than nothing, would it be dialog? Or simply true?

@afercia
Copy link
Contributor Author

afercia commented Sep 24, 2020

When the opened UI isn't one of the cases listed by the ARIA 1.1 spec (menu, listbox, tree, grid, dialog) I'd say the safest option is true.

@jorgefilipecosta
Copy link
Member

Hi @afercia, @tellyworth,
I conducted some tests within the editor. The styles I added using the developer tools proved useful:

[aria-expanded] {
    border: 2px solid red !important;
}

It appears that the link format, inserter, and list view were the remaining cases lacking the aria-haspopup and aria-expanded attributes. I've submitted PR's to rectify these concerns. Are there any other cases that require attention?

@jorgefilipecosta
Copy link
Member

I'm closing the issue as it appears the remaining cases were addressed if there is any remaining issue feel free to reopen.

@afercia
Copy link
Contributor Author

afercia commented Aug 25, 2023

@jorgefilipecosta thanks much for working on this. Also, nice to see you again.
Sure if we will notice remaining issues with these attributes we will either reopen or report separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

4 participants