Skip to content

Commit b26f5fc

Browse files
HaRukiguidari
andauthored
fix(react): tableSelectAll checkbox checked=true when it's not(#15386) (#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 <[email protected]>
1 parent 9c8c301 commit b26f5fc

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/react/src/components/InlineCheckbox/InlineCheckbox.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const InlineCheckbox = React.forwardRef(function InlineCheckbox(
3838
disabled,
3939
id,
4040
name,
41-
onClick,
41+
onClick: onClick ? onClickCheckBoxInput : onClick,
4242
onChange: (evt) => {
4343
onChange(evt.target.checked, id, evt);
4444
},
@@ -57,6 +57,14 @@ const InlineCheckbox = React.forwardRef(function InlineCheckbox(
5757
}
5858
}, [indeterminate]);
5959

60+
function onClickCheckBoxInput(evt) {
61+
// If the previous "indeterminate" is true, change "checked" to false. If it is not undefined, we're working on `TableSelectAll`
62+
if (indeterminate) {
63+
evt.target.checked = false;
64+
}
65+
onClick(evt);
66+
}
67+
6068
return (
6169
<div className={`${prefix}--checkbox--inline`}>
6270
<input {...inputProps} />

0 commit comments

Comments
 (0)