From b26f5fc79ae8d4d64a43ea535be4958018d1ff71 Mon Sep 17 00:00:00 2001 From: HaRuki Date: Tue, 2 Jan 2024 10:29:51 -0800 Subject: [PATCH] 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 --- .../src/components/InlineCheckbox/InlineCheckbox.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/react/src/components/InlineCheckbox/InlineCheckbox.js b/packages/react/src/components/InlineCheckbox/InlineCheckbox.js index 662ba416ef90..3d02d247b959 100644 --- a/packages/react/src/components/InlineCheckbox/InlineCheckbox.js +++ b/packages/react/src/components/InlineCheckbox/InlineCheckbox.js @@ -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); }, @@ -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 (