From ae0bca6327e00432aafa8eb744e08c810d0357eb Mon Sep 17 00:00:00 2001 From: matttdawson <89495499+matttdawson@users.noreply.github.com> Date: Tue, 24 Sep 2024 15:51:57 +1200 Subject: [PATCH] fix: loop on boolean edit when read only (#490) --- .../clickInputWhenContainingCellClicked.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/clickInputWhenContainingCellClicked.tsx b/src/components/clickInputWhenContainingCellClicked.tsx index e3dc0e69..78fa9889 100644 --- a/src/components/clickInputWhenContainingCellClicked.tsx +++ b/src/components/clickInputWhenContainingCellClicked.tsx @@ -1,5 +1,4 @@ import { CellClickedEvent } from "ag-grid-community"; -import { fnOrVar } from "../utils/util"; /** * AgGrid checkbox select does not pass clicks within cell but not on the checkbox to checkbox. @@ -9,13 +8,14 @@ export const clickInputWhenContainingCellClicked = (params: CellClickedEvent) => const { data, event, colDef } = params; if (!data || !event) return; - if (fnOrVar(colDef.editable, params) === false) { - return; - } - const element = event.target as Element; // Already handled - if (["BUTTON", "INPUT"].includes(element?.tagName) && element.closest(".ag-cell-inline-editing")) return; + if ( + element.closest(".GridCell-readonly") || + (["BUTTON", "INPUT"].includes(element?.tagName) && element.closest(".ag-cell-inline-editing")) + ) { + return; + } const row = element.closest("[row-id]"); if (!row) return;