From 4efb406b144b682fbde3bc23d6fad36de757afd6 Mon Sep 17 00:00:00 2001 From: Filip Hlavac Date: Wed, 10 Apr 2024 14:46:50 +0200 Subject: [PATCH] fix(WarningModal): Reset check state on close --- packages/module/src/WarningModal/WarningModal.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/module/src/WarningModal/WarningModal.tsx b/packages/module/src/WarningModal/WarningModal.tsx index 371ddc6b..341b5330 100644 --- a/packages/module/src/WarningModal/WarningModal.tsx +++ b/packages/module/src/WarningModal/WarningModal.tsx @@ -44,7 +44,10 @@ const WarningModal: React.FunctionComponent = ({ ouiaId="primary-confirm-button" key="confirm" variant={confirmButtonVariant} - onClick={onConfirm} + onClick={() => { + onConfirm?.(); + setChecked(false); + }} isDisabled={withCheckbox && !checked} > {confirmButtonLabel} @@ -64,7 +67,7 @@ const WarningModal: React.FunctionComponent = ({ {withCheckbox ? ( setChecked(!checked)} + onChange={(_event, value) => setChecked(value)} label={checkboxLabel} id="warning-modal-check" className="pf-v5-u-mt-lg"