File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
packages/features/data-table/components Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff 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 && {
You can’t perform that action at this time.
0 commit comments