Skip to content

Commit

Permalink
[charts] Prevent invalid releasePointerCapture (@alexfauquette) (#1…
Browse files Browse the repository at this point in the history
…5609)

Signed-off-by: Jose C Quintas Jr <[email protected]>
Co-authored-by: Alexandre Fauquette <[email protected]>
Co-authored-by: Jose C Quintas Jr <[email protected]>
  • Loading branch information
3 people authored Nov 26, 2024
1 parent ca9b2e7 commit 8836659
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/x-charts/src/hooks/useInteractionItemProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ export const useInteractionItemProps = (skip?: boolean) => {
});
};
const onPointerLeave = (event: React.PointerEvent) => {
event.currentTarget.releasePointerCapture(event.pointerId);
if (event.currentTarget.hasPointerCapture(event.pointerId)) {
event.currentTarget.releasePointerCapture(event.pointerId);
}

dispatchInteraction({ type: 'leaveItem', data });
clearHighlighted();
};
Expand Down

0 comments on commit 8836659

Please sign in to comment.