From 35406406962c89bac0503800771d96ba2f47f56d Mon Sep 17 00:00:00 2001 From: Alan Hamlett Date: Wed, 30 Oct 2024 10:53:52 +0100 Subject: [PATCH] fix(tooltip): Hide tooltip on redraw when unexpected error Fix getting element from non numeric coordinate value, otherwise hide tooltip Fix #3909 Close #3910 --- AUTHORS.txt | 3 ++- src/ChartInternal/internals/tooltip.ts | 9 ++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/AUTHORS.txt b/AUTHORS.txt index 00f715c4d..b0289da3e 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -67,4 +67,5 @@ nekoya Ubin Park William Nolden Sergiu Statache -vlaforet \ No newline at end of file +vlaforet +Alan Hamlett diff --git a/src/ChartInternal/internals/tooltip.ts b/src/ChartInternal/internals/tooltip.ts index bd9badd6c..60700f4b0 100644 --- a/src/ChartInternal/internals/tooltip.ts +++ b/src/ChartInternal/internals/tooltip.ts @@ -657,14 +657,13 @@ export default { $$.setExpand(idx, null, true); } } - - // for Arc & Treemap - } else { + } else { // for Arc & Treemap const {clientX, clientY} = event; setTimeout(() => { - let target = document.elementFromPoint(clientX, clientY); - const data = d3Select(target).datum() as IArcData; + let target = [clientX, clientY].every(Number.isFinite) && + document.elementFromPoint(clientX, clientY); + const data = target && d3Select(target).datum() as IArcData; if (data) { const d = $$.hasArcType() ?