Skip to content

Commit 8043505

Browse files
authored
fix: prevent modal clicks from closing when used in booking list (#25153)
1 parent 919fc3c commit 8043505

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/features/data-table/components/DataTable.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,14 @@ function DataTableBody<TData>({
400400
{...computedDataAttributes}
401401
data-index={virtualItem?.index} // needed for dynamic row height measurement
402402
data-state={row.getIsSelected() && "selected"}
403-
onClick={() => onRowMouseclick && onRowMouseclick(row)}
403+
onClick={(e) => {
404+
if (!onRowMouseclick) return;
405+
const target = e.target as Node | null;
406+
const current = e.currentTarget as HTMLElement | null;
407+
// Only invoke the handler when the event target is inside the row element.
408+
if (!target || !current || !current.contains(target)) return;
409+
onRowMouseclick(row);
410+
}}
404411
style={{
405412
display: "flex",
406413
...(virtualItem && {

0 commit comments

Comments
 (0)