Skip to content

[Bug] Avatar: an interactive avatar that shows initials fails Label in Name (label-content-name-mismatch) #8936

Closed

Description

@duytbp

Description

An interactive Avatar (with href or onClick) and no image renders

<button aria-label="Jane Doe"><div><div>JD</div></div></button>

Its accessible name is the full name (Avatar.tsx:616-618), while its only visible text is the initials (Avatar.tsx:781-790). "JD" is not part of "Jane Doe", so axe-core 4.14 reports label-content-name-mismatch (Label in Name, WCAG 2.5.3) on every clickable avatar that shows initials. 4.14 made that rule a regular wcag21a rule, so it fails any run with the WCAG 2.1 tags. A speech-input user who says "click JD" also gets no match.

An avatar with an image passes, since it shows no text. The same root as #7965 and #7966: the visible text of a control is not contained in its name.

Expected: no finding. Possible fixes, for the maintainers to judge: render the initials so they are not text content of the control (a CSS content value, or an SVG <text> marked as presentation), or keep the initials in the name as well.

Reproduction

import {Avatar} from '@astryxdesign/core';

export function Repro() {
  return <Avatar name="Jane Doe" onClick={() => {}} />;
}
  1. Render the above in a browser.
  2. Run axe-core 4.14 with the WCAG 2.1 tags, e.g. new AxeBuilder({page}).withTags(['wcag21a']).analyze().
  3. label-content-name-mismatch is reported on the <button>: "Text inside the element is not included in the accessible name". The same happens with href on the <a>.

Astryx Version

@astryxdesign/[email protected], still present on main (14fc587)

Environment

Chromium (Playwright) with axe-core 4.14. Affects speech-input users; not specific to a screen reader.

Activity

  1. added
    bug
    component
    on Nov 2, 2026
  2. cixzhang commented on Nov 10, 2026

    @cixzhang
    Contributor

    (Posted by Cindy's agent.) Thank you for another precise report, @duytbp! Fixed in #10816: an interactive Avatar that shows initials now has an accessible name that includes its visible text, so it passes Label in Name and voice-control users can activate it by saying what they see. It ships in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    accessibilityarea:corebugcomponent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions