Skip to content

Commit

Permalink
fix: prevent default onkeypress action
Browse files Browse the repository at this point in the history
  • Loading branch information
eliobricenov committed Feb 17, 2021
1 parent aea3fdb commit 1f6397a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/Input/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ class Checkbox extends React.PureComponent {
if (checked) return 'true'
return 'false'
}
handleClick = () => {
handleKeyPress = e => {
e.preventDefault()
}
handleClick = e => {
const { onChange, checked, indeterminate } = this.props
onChange(indeterminate ? false : !checked)
}
Expand Down Expand Up @@ -95,6 +98,7 @@ class Checkbox extends React.PureComponent {
tabIndex={tabIndex}
aria-checked={this.getAriaChecked()}
onClick={this.handleClick}
onKeyPress={this.handleKeyPress}
onFocus={onFocus}
disabled={disabled}
css={`
Expand Down

0 comments on commit 1f6397a

Please sign in to comment.