Skip to content

Commit

Permalink
fix(react): tableSelectAll checkbox checked=true when it's not(#15386) (
Browse files Browse the repository at this point in the history
#15443)

* fix(react): tableSelectAll checkbox checked=true when it's not(#15386)

* fix(react): tableSelectAll checkbox checked=true when it's not(#15386)

---------

Co-authored-by: Guilherme Datilio Ribeiro <guilhermedatilio@gmail.com>
  • Loading branch information
kuri-sun and guidari authored Jan 2, 2024
1 parent 9c8c301 commit b26f5fc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/react/src/components/InlineCheckbox/InlineCheckbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const InlineCheckbox = React.forwardRef(function InlineCheckbox(
disabled,
id,
name,
onClick,
onClick: onClick ? onClickCheckBoxInput : onClick,
onChange: (evt) => {
onChange(evt.target.checked, id, evt);
},
Expand All @@ -57,6 +57,14 @@ const InlineCheckbox = React.forwardRef(function InlineCheckbox(
}
}, [indeterminate]);

function onClickCheckBoxInput(evt) {
// If the previous "indeterminate" is true, change "checked" to false. If it is not undefined, we're working on `TableSelectAll`
if (indeterminate) {
evt.target.checked = false;
}
onClick(evt);
}

return (
<div className={`${prefix}--checkbox--inline`}>
<input {...inputProps} />
Expand Down

0 comments on commit b26f5fc

Please sign in to comment.