We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 919fc3c commit 8043505Copy full SHA for 8043505
1 file changed
packages/features/data-table/components/DataTable.tsx
@@ -400,7 +400,14 @@ function DataTableBody<TData>({
400
{...computedDataAttributes}
401
data-index={virtualItem?.index} // needed for dynamic row height measurement
402
data-state={row.getIsSelected() && "selected"}
403
- onClick={() => onRowMouseclick && onRowMouseclick(row)}
+ 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
+ }}
411
style={{
412
display: "flex",
413
...(virtualItem && {
0 commit comments