Skip to content

Commit

Permalink
fix(TooltipContext): Call hideTooltip() for all tooltip modes on `p…
Browse files Browse the repository at this point in the history
…ointerleave` to fix `band` (BarChart) and `voronoi` (ScatterPlot) modes not always closing on chart pointerleave due to recent chart delay / tooltip hover changes
  • Loading branch information
techniq committed Feb 19, 2025
1 parent aefcd3e commit e9f5e8c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/strong-worms-rhyme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'layerchart': patch
---

fix(TooltipContext): Call `hideTooltip()` for all tooltip modes on `pointerleave` to fix `band` (BarChart) and `voronoi` (ScatterPlot) modes not always closing on chart pointerleave due to recent chart delay / tooltip hover changes
Original file line number Diff line number Diff line change
Expand Up @@ -411,13 +411,15 @@
showTooltip(e);
}
}}
on:pointermove={triggerPointerEvents ? showTooltip : undefined}
on:pointerleave={(e) => {
isHoveringTooltip = false;
on:pointermove={(e) => {
if (triggerPointerEvents) {
hideTooltip();
showTooltip(e);
}
}}
on:pointerleave={(e) => {
isHoveringTooltip = false;
hideTooltip();
}}
on:click={(e) => {
if (triggerPointerEvents) {
onclick(e, { data: $tooltip?.data });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@
]}
{renderContext}
{debug}
tooltip={{ hideDelay: 1000 }}
tooltip={{ hideDelay: 500 }}
>
<svelte:fragment slot="tooltip" let:x let:y let:series let:height let:setHighlightSeriesKey>
<Tooltip.Root x="data" y={height + 24} pointerEvents let:data>
Expand Down

0 comments on commit e9f5e8c

Please # to comment.