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][utils] Add aria-disabled attribute to useSlot #45502

Closed

Conversation

dinesjo
Copy link

@dinesjo dinesjo commented Mar 6, 2025

Closes #45436

As requested by the issue, the attribute aria-disabled="true" is now applied directly to the input element for input components which use the useSlot hook (Autocomplete, Checkbox, Radio, Switch, TextField). It is of course present if and only if the component has property disabled.

Added unit tests to affected components to ensure that the attribute is applied properly and only when the component is disabled.

@mui-bot
Copy link

mui-bot commented Mar 6, 2025

Netlify deploy preview

https://deploy-preview-45502--material-ui.netlify.app/

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against 76e1278

@zannager zannager added accessibility a11y component: switch This is the name of the generic UI component, not the React module! package: utils Specific to the @mui/utils package labels Mar 7, 2025
@zannager zannager requested a review from siriwatknp March 7, 2025 11:27
@siriwatknp
Copy link
Member

Thanks for submitting the PR! I'm reviewing it, will update you within the week.

@siriwatknp
Copy link
Member

First of all, thank you for submitting the PR.
However, the proper solution to #45436 is to reconsider the aria-disabled on the span element but not adding aria-disabled to the input element since disabled attribute is already used.

Please see the details from MDN.

I'm closing this PR.

@siriwatknp siriwatknp closed this Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility a11y component: switch This is the name of the generic UI component, not the React module! package: utils Specific to the @mui/utils package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Switch] disabled prop doesn't set aria-disabled on input element
4 participants