Skip to content

Commit

Permalink
fix: switch behavior
Browse files Browse the repository at this point in the history
(cherry picked from commit 14464fa)
  • Loading branch information
dahaca authored and vdovhanych committed May 10, 2022
1 parent 4fc5e88 commit 33055e9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/components/src/components/form/Switch/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,20 @@ export const Switch = ({
isChecked={isChecked}
isDisabled={isDisabled}
isSmall={isSmall}
onClick={() => onChange(isChecked)}
onClick={e => {
e.preventDefault();
onChange(!isChecked);
}}
className={className}
data-test={dataTest}
>
<Handle isSmall={isSmall} isChecked={isChecked} />
<Handle isSmall={isSmall} isChecked={isChecked} type="button" />
<CheckboxInput
type="checkbox"
role="switch"
checked={isChecked}
disabled={isDisabled}
onChange={() => onChange(isChecked)}
onChange={() => onChange(!isChecked)}
aria-checked={isChecked}
/>
</Container>
Expand Down

0 comments on commit 33055e9

Please sign in to comment.