Skip to content

[tooltip] aria-label overwrites trigger's visible text #47246

@abdermaiza

Description

@abdermaiza

Steps to reproduce

Steps:

  1. Open this link to live example: https://mui.com/material-ui/react-tooltip/
  2. Look at the tooltip code (the HTML generated in the browser console)
  3. There is an aria-label attribute inside the button
  4. That will unfortunately overwrite the button content, for assistive technologies like screen readers.

Current behavior

The aria-label inside the button is erasing the accessible name of this button, like:
<button type="button" aria-label="add">Margin</button>

Screen readers will here read "Button add", instead of "Button Margin add".

Image

Expected behavior

The aria-label inside the button should be removed, like:
<button type="button">Margin <span class="MuiTouchRipple-root css-4mb1j7">Add</span></button>

To provide an accessible tooltip, we should only generate a text in the span inside this button, when focusing it.

Context

Make the MUI tooltip more accessible (comprehensive) for screen reader users.

Your environment

Chrome v142, tested with NVDA.

Search keywords: tooltip

Metadata

Metadata

Assignees

No one assigned

    Labels

    accessibilitya11yhas workaroundThere’s a bug, but users have a complete workaround, so no urgent fix or release is needed.scope: tooltipChanges related to the tooltip.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions