Skip to content

[a11y]: Use aria-errormessage for invalid inputs #21247

@seanlafferty-ibm

Description

@seanlafferty-ibm

Package

@carbon/react

Browser

No response

Operating System

No response

Package version

1.97.0

React version

No response

Automated testing tool and ruleset

NA

Assistive technology

No response

Description

Carbon currently sets an aria-describedby to point to the error message generated from an invalid text input. I prefer if this used aria-errormessage as described by https://w3c.github.io/aria/#aria-errormessage, as there are helpers in tools like playwright to write assertions against that aria field eg

await expect(locator).toHaveAccessibleErrorMessage(expected, options);

WCAG 2.1 Violation

No response

Reproduction/example

N/A

Steps to reproduce

N/A

Suggested Severity

None

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    Severity

    None yet

    Projects

    Status
    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions