-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat(checkbox-input): support isReadOnly prop #1157
Conversation
const { onChange } = props; | ||
|
||
const handleChange = React.useCallback( | ||
event => !props.isReadOnly && onChange && onChange(event), |
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.
Why use JS? Why isn't setting readOnly
on the input enough?
https://stackoverflow.com/questions/155291/can-html-checkboxes-be-set-to-readonly
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 sharing. I often wanted to ask UX "what's the different line in communication towards the user between readonly and disabled? When use which?"
baseStyles, | ||
css` | ||
svg [id$='borderAndContent'] > [id$='content'] { | ||
fill: ${overwrittenVars[designTokens.fontColorForInputWhenReadonly]}; |
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.
same look as for RadioInputs when readOnly
const { onChange } = props; | ||
|
||
const handleChange = React.useCallback( | ||
event => !props.isReadOnly && onChange && onChange(event), |
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 sharing. I often wanted to ask UX "what's the different line in communication towards the user between readonly and disabled? When use which?"
Summary
Addresses one of the cases here