Skip to content

Commit

Permalink
fix: trigger onMouseMove when cursor leaves the column header
Browse files Browse the repository at this point in the history
  • Loading branch information
Aram Vardanyan committed Jun 20, 2023
1 parent 4e827ef commit d741b7f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/core/src/data-grid/data-grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1065,11 +1065,17 @@ const DataGrid: React.ForwardRefRenderFunction<DataGridRef, DataGridProps> = (p,
const eventTarget = eventTargetRef?.current;
const scrollerContainsTarget = eventTarget?.contains(ev.target as Node) ?? false

if (canvas === null || (ev.target !== canvas && ev.target !== eventTarget && !scrollerContainsTarget)) {
if (canvas === null) {
return;
}

const args = getMouseArgsForPosition(canvas, ev.clientX, ev.clientY, ev);

// when the cursor is in the grid area, but it's on a overlay element like a popup which is not part of the grid
if ((args.kind !== outOfBoundsKind && ev.target !== canvas && ev.target !== eventTarget && !scrollerContainsTarget)) {
return;
}

if (!isSameItem(args, hoveredRef.current)) {
onItemHovered?.(args);
setHoveredItemInfo(
Expand Down

0 comments on commit d741b7f

Please sign in to comment.