Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
[Select] When disabled the <input> element misses the disabled attribute #23693
Comments
|
@masoodusmani Thanks for the report, this looks accurate:
https://www.w3.org/TR/html51/sec-forms.html#element-attrdef-disabledformelements-disabled What do you think about this diff? Do you want to work on a pull request? :) diff --git a/packages/material-ui/src/Select/SelectInput.js b/packages/material-ui/src/Select/SelectInput.js
index ded48e9e1d..34244bb0ef 100644
--- a/packages/material-ui/src/Select/SelectInput.js
+++ b/packages/material-ui/src/Select/SelectInput.js
@@ -401,6 +401,7 @@ const SelectInput = React.forwardRef(function SelectInput(props, ref) {
aria-hidden
onChange={handleChange}
tabIndex={-1}
+ disabled={disabled}
className={classes.nativeInput}
autoFocus={autoFocus}
{...other} |
|
@oliviertassinari Looks good! I'd like to work on it, sure. I'll check the contributing guide today, and see if I can get set up later today. |


Current Behavior😯
When you create a
<TextField select disabled />, the<input>element does not have the disabled prop, classes and aria-disabled="true" are added to the div to mark it as disabledExpected Behavior🤔
The input element should have the disabled prop
Steps to Reproduce🕹
https://codesandbox.io/s/material-demo-forked-0n5s1?file=/demo.tsx
If you inspect the select field, the input element is not disabled, but it is disabled in the native select (though that's a select element)
Context🔦
When a form field is disabled, its value is not supposed to be submitted when a form is submitted. I wanted to use that property to submit partial data, conditionally. Also, testing aria-disabled=true to check if it's disabled does not seem idiomatic.
Neither of these is very important, but the behaviour is unexpected when a regular TextField disables its input
Your Environment🌎