Bug - MenuItem- Tooltips on MenuItems aren't being announced
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
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
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-describedbyon 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
ComponentJSX (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.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.