Skip to content

fix(ui-menu): screenreaders should read the correct number of menu items#1831

Merged
matyasf merged 1 commit intomasterfrom
menu_sr_fix
Feb 3, 2025
Merged

fix(ui-menu): screenreaders should read the correct number of menu items#1831
matyasf merged 1 commit intomasterfrom
menu_sr_fix

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

@matyasf matyasf self-assigned this Dec 18, 2024
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

<div
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

>
<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

@github-actions
Copy link

github-actions bot commented Dec 18, 2024

PR Preview Action v1.6.0
Preview removed because the pull request was closed.
2025-02-03 13:07 UTC

@matyasf matyasf requested review from HerrTopi and balzss 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
Copy link
Contributor

@balzss balzss left a comment

Choose a reason for hiding this comment

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

left one comment but otherwise looks and works well, great job

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 merged commit 0670648 into master Feb 3, 2025
11 checks passed
@matyasf matyasf deleted the menu_sr_fix branch February 3, 2025 13:07
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.

3 participants