firefox checkbox overlap workaround (#2329)
This commit is contained in:
parent
575a91b5e9
commit
7dc06cef91
1 changed files with 16 additions and 1 deletions
|
@ -23,6 +23,11 @@ export type CheckboxProps = Omit<
|
||||||
error?: boolean;
|
error?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const firefoxHandler = (event, onChange, checked) => {
|
||||||
|
event.preventDefault();
|
||||||
|
onChange(event, checked);
|
||||||
|
};
|
||||||
|
|
||||||
const Checkbox: React.FC<CheckboxProps> = ({ helperText, error, ...props }) => {
|
const Checkbox: React.FC<CheckboxProps> = ({ helperText, error, ...props }) => {
|
||||||
const { disableClickPropagation, ...rest } = props;
|
const { disableClickPropagation, ...rest } = props;
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
|
@ -32,7 +37,17 @@ const Checkbox: React.FC<CheckboxProps> = ({ helperText, error, ...props }) => {
|
||||||
<MuiCheckbox
|
<MuiCheckbox
|
||||||
{...rest}
|
{...rest}
|
||||||
onClick={
|
onClick={
|
||||||
disableClickPropagation ? event => event.stopPropagation() : undefined
|
disableClickPropagation
|
||||||
|
? event => {
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
/*
|
||||||
|
Workaround for firefox
|
||||||
|
ref: https://bugzilla.mozilla.org/show_bug.cgi?id=62151
|
||||||
|
*/
|
||||||
|
firefoxHandler(event, rest.onChange, rest.checked);
|
||||||
|
}
|
||||||
|
: undefined
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
{helperText && (
|
{helperText && (
|
||||||
|
|
Loading…
Reference in a new issue