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

feat(checkbox-input): support isReadOnly prop #1157

Merged
merged 2 commits into from
Nov 4, 2019
Merged

Conversation

montezume
Copy link
Contributor

Summary

Addresses one of the cases here

const { onChange } = props;

const handleChange = React.useCallback(
event => !props.isReadOnly && onChange && onChange(event),
Copy link
Contributor Author

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

Copy link
Contributor

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]};
Copy link
Contributor Author

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),
Copy link
Contributor

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?"

@montezume
Copy link
Contributor Author

@tdeekens yeah, I like to think about it like

readonly: submitted in form
disabled: not submitted in form

ref

@kodiakhq kodiakhq bot merged commit 798b95e into master Nov 4, 2019
@kodiakhq kodiakhq bot deleted the ml-checkbox-readonly branch November 4, 2019 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants