patternfly-react icon indicating copy to clipboard operation
patternfly-react copied to clipboard

Bug - MenuItem- Tooltips on MenuItems aren't being announced

Open thatblindgeye opened this issue 2 years ago • 3 comments

Describe the problem MenuItem

How do you reproduce the problem? Navigate to a menu item with tooltip in our Menu examples (first example has a tooltip on the first aria-disabled item) with VoiceOver/a screen reader, notice that the tooltip doesn't get announced.

Expected behavior The tooltip content gets announced when it is rendered

Any other information? Seems the aria-describedby attribute isn't being applied to the internal button of MenuItem when the Tooltip renders

thatblindgeye avatar Aug 17 '23 20:08 thatblindgeye

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

github-actions[bot] avatar Jan 27 '25 11:01 github-actions[bot]

Additional context for this from https://github.com/patternfly/patternfly-react/issues/11639:

Menu items that have tooltips aren't linked to those tooltips as expected via aria-describedby on the menu item linking to the toolktip's ID.

Left a comment that goes into what the issue looks to be, that the way Tooltip tries to clone its children to auto-apply aria attributes doesn't work with MenuItem due to the first child being a fragment. Ideally we should try wrapping the Tooltip around the Component JSX (within the renderItem var), though we could also look into trying to auto-apply the aria-describedby and labelledby attributes when a ref is used as well (though not a priority for this issue since currently consumers need to handle that themselves).

Depending on if the above suggestion results in a breaking change of markup structure, though, we could also try adding some logic to Tooltip to look for the first valid element that is cloned to add the aria attributes to. If we need to we can put this into the breaking change bucket and revisit it at that point, though.

thatblindgeye avatar Mar 26 '25 13:03 thatblindgeye

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

github-actions[bot] avatar Jun 10 '25 11:06 github-actions[bot]