when TextField is used as a select, it isn't using error to mark the select element with aria-invalid
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 99.1k
- Forks
- 32.5k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 106
Description
When using the TextField as a select with error={true}, the field is not found to be invalid. This is because aria-invalid isn't set on the labeled field.
- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
aria-invalid isn't set on the select element
Expected Behavior 🤔
aria-invalid should be set to the value of error passed to TextField
Steps to Reproduce 🕹
codesandbox example with tests
The codesandbox shows:
- TextField is invalid when error is true
- TextField is not invalid when used as a select and error is true
- TextField is invalid when used as a select when aria-invalid is passed through the
SelectProps'sSelectDisplayProps
Context 🔦
This makes it require extra steps to mark the select as invalid.
Your Environment 🌎
`npx @mui/envinfo`
using the codesandbox environment
Google Chrome Version 95.0.4638.54 (Official Build) (x86_64)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked CodeSandbox and its src/App.test.tsx test, which reproduces TextField with error={true} both normally and as a select. Trace how SelectDisplayProps currently receives aria-invalid and verify the select case. Done means the select is marked aria-invalid from the TextField error prop without extra SelectDisplayProps configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react
- Domain
- accessibility, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100