-
Notifications
You must be signed in to change notification settings - Fork 80
Disable key behavior when component disabled #15
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
Conversation
Add space and enter key support for toggling checked state Disable key behavior when component in disabled state
|
@afc163 Is this suitable for merge? Thanks! |
examples/simple.js
Outdated
| disabled: false, | ||
| }; | ||
| toggle = () => { | ||
| const Test = React.createClass({ |
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??? We should not use React.createClass after React@15.5, just use ES6 class.
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.
Np, updating was just following conventions used in other components
|
👍 |
src/Switch.jsx
Outdated
| } | ||
| if (e.keyCode === 39) { | ||
| this.setChecked(true); | ||
| if (!this.props.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.
It is better to put disabled logic into setChecked.
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.
Ok done
|
Thx @delesseps ! |
Also...