-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
[Checkbox, Menu, Switch] Audit focus states on disabled components #734
[Checkbox, Menu, Switch] Audit focus states on disabled components #734
Conversation
Netlify deploy preview |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this! With a few tweaks this will be good to merge.
@@ -98,6 +98,7 @@ const CheckboxRoot = React.forwardRef(function CheckboxRoot( | |||
extraProps: { | |||
...otherProps, | |||
...otherGroupProps, | |||
disabled, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of passing disabled
here, it should be set by useCheckboxRoot
's getButtonProps
. You can remove aria-disabled
and have just disabled
prop returned from there.
Same with the Switch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for pointing that out! 🙏 I’ve updated the code.
Please let me know if there are any further changes needed. 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears that removing aria-disabled is causing CircleCI’s browser tests to fail. Do you think we should reintroduce aria-disabled alongside the disabled prop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the various a11y resources, we are not required to use aria-disabled if we already are using native form elements like button with appropriate roles like switch or checkbox. what do you think @michaldudak ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, having just the disabled
attribute is enough. Using both disabled
and aria-disabled
is redundant and may trigger warnings in some a11y validators.
IMO the way to go would be updating the tests to expect the disabled
attribute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michaldudak I have fixed the tests, Please review it again. Thanks !
…ove 'aria-disabled'. Applied the same update to Switch component.
…led for Switch and Checkbox components.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks for your contribution!
…ui#734) Co-authored-by: hakimuddinhh <[email protected]>
Changes -
[] I have followed (at least) the PR section of the contributing guide.
closes #656