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(ui-menu): screenreaders should read the correct number of menu items #1831

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

matyasf
Copy link
Collaborator

@matyasf matyasf commented Dec 18, 2024

Closes: INSTUI-4285

Tested on VoiceOver, NVDA, JAWS. Also simplified DOM structure quite a bit, there are multiple examples of Menu online that do not use a List to wrap the whole thing, it was not needed

TEST PLAN:
Open the Menu example and go trough it with NVDA, JAWS, VoiceOver. You should be able to navigate and they should read the correct menu item number (e.g. 3 of 7).
Check the DOM structure with the inspector to see if it looks OK

Closes: INSTUI-4285

Tested on VoiceOver, NVDA, JAWS. Also simplified DOM structure quite a bit
TEST PLAN:
Open the Menu example and go trough it with NVDA, JAWS, VoiceOver. You should be able to navigate
and they should read the correct menu item number (e.g. 3 of 7)
@matyasf matyasf self-assigned this Dec 18, 2024
@@ -187,8 +187,6 @@ class MenuItem extends Component<MenuItemProps, MenuItemState> {
return 'menuitemcheckbox'
case 'radio':
return 'menuitemradio'
case 'flyout':
return 'button'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A Menu having a button not a menuitem was driving NVDA crazy. NVDA really seems to be the most strict of them all

css={this.props.styles?.items}
aria-disabled={this.props.disabled ? 'true' : undefined}
aria-labelledby={this._labelId}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no need for aria-labelledby . Also its not usable for generic elements

ref={this.handleRef}
>
<span id={this._labelId}>{this.renderLabel()}</span>
<ul
role="menu"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be used for submenus and menus, not for groups per specification https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/menu_role

Copy link

PR Preview Action v1.4.8
🚀 Deployed preview to https://instructure.github.io/instructure-ui/pr-preview/pr-1831/
on branch gh-pages at 2024-12-18 14:50 UTC

@matyasf matyasf requested review from balzss and HerrTopi December 19, 2024 09:35
@matyasf matyasf changed the title WIP fix(ui-menu): screenreaders should read the correct number of menu items fix(ui-menu): screenreaders should read the correct number of menu items Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant