Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[material-ui][TextField] Attach aria-errormessage attribute #38929

Open
2 tasks done
sdemjanenko opened this issue Sep 12, 2023 · 3 comments
Open
2 tasks done

[material-ui][TextField] Attach aria-errormessage attribute #38929

sdemjanenko opened this issue Sep 12, 2023 · 3 comments
Assignees
Labels
accessibility a11y component: text field This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature on hold There is a blocker, we need to wait package: material-ui Specific to @mui/material

Comments

@sdemjanenko
Copy link

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Summary 💡

I noticed that the TextField component does not take advantage of the aria-errormessage attribute. In this example

<TextField
    label="Name"
    size='small'
    fullWidth
    margin='normal'
    placeholder='What do you want to call it?'
    error={Boolean(errors.name)}
    helperText={errors.name?.message}
/>

The input that is rendered in the DOM has aria-invalid="true" and aria-describedby=":rl:-helper-text" which points to <p id=":rl:-helper-text" ...>Must be at least 2 characters</p>. It does not have aria-errormessage attribute set. Please see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-errormessage

Examples 🌈

No response

Motivation 🔦

No response

@sdemjanenko sdemjanenko added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Sep 12, 2023
@zannager zannager added the component: text field This is the name of the generic UI component, not the React module! label Sep 12, 2023
@danilo-leal danilo-leal changed the title Attach aria-errormessage to TextField [material-ui][TextField] Attach aria-errormessage attribute Sep 12, 2023
@danilo-leal danilo-leal added the package: material-ui Specific to @mui/material label Sep 12, 2023
@mj12albert mj12albert added accessibility a11y enhancement This is not a bug, nor a new feature and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Sep 19, 2023
@blakenetz
Copy link
Contributor

Though it's not explicitly called out in the W3 docs, it appears the aria-errormessage attribute should take the place of the aria-description attribute when the component is in an invalid state (i.e. aria-invalid="true"). I have a branch that makes these changes in the InputBase comp, but I'm not entirely sure y'all's stance on overwriting user-assign props. Alternatively, I can render both attributes and do some tests with VoiceOver, but I thought I'd start by polling here.

@blakenetz
Copy link
Contributor

blakenetz commented Oct 31, 2023

Just following up on this. As of today, it doesn't look like aria-errormessage has full browser support:

@garyb1
Copy link

garyb1 commented Mar 2, 2024

I agree with @blakenetz that support is not there yet.

Adrian Roselli wrote about exposing field errors in August and some of the findings are interesting. He also notes that some chromium browsers treat aria-describedby as a live region.

See active discussion about aria-errormessage support for NVDA which is open since 2018.

@mj12albert mj12albert added the on hold There is a blocker, we need to wait label Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility a11y component: text field This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature on hold There is a blocker, we need to wait package: material-ui Specific to @mui/material
Projects
None yet
Development

No branches or pull requests

6 participants