You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[TooltipContext] Tooltip locked from onclick loses its data on touch, and the lock can't be released #922
Repro here (open the repro as separate page and open devtools for it or open on the actual phone - even better)
tl;dr:
Expected behaviour: first tap pins the tooltip, second tap unpins it.
Actual: the tooltip vanishes right after the first tap, locked: true stays, next taps do nothing.
--
When locked is switched on from the tooltip's onclick (tap to pin), on a touch device the tooltip disappears right after the tap, locked stays true, and no further tap reaches onclick. The chart is stuck without a tooltip until it is remounted. With a mouse it works fine tho.
The click that follows sets locked = true, but the callback never re-checks locked, and the timeout is cleared only on the next show. So it clears tooltipState.data under the lock. After that every tap is ignored: showing is refused while locked, and the root onclick is only forwarded when tooltipState.data != null, so locked can't be set back to false.
Re-checking locked inside the timeout fixes it (checked against the repro above):
hideTimeoutId = setTimeout(() => {
+ // The tooltip may have been locked since this hide was scheduled (e.g. tap to pin)+ if (locked) return;
if (!tooltipState.isHoveringTooltipArea && !tooltipState.isHoveringTooltipContent) {
Clearing hideTimeoutId when locked becomes true would work too.
For now I work around it by calling context.tooltip.show(e, data) in onclick right before locking, which cancels the pending hide.
layerchart 2.5.0 (same code on main at ddceba2), svelte 5.55.5, Chromium 147 (Playwright), touch emulation.
Hey @ntainy, thank you for the detailed description and concise reproduction! Very much appreciated 🫶.
The fix is also straight forward and would appreciate a PR if you have time.
I also ran this by an agent to see if it had any additional feedback and it's callout about the tooltip staying visible (but unlocked) looks like something we'd want to validate and address as well. Also adding some tests would be great to have coverage.
Activity
techniq commentedon Oct 1, 2026
Hey @ntainy, thank you for the detailed description and concise reproduction! Very much appreciated 🫶.
The fix is also straight forward and would appreciate a PR if you have time.
I also ran this by an agent to see if it had any additional feedback and it's callout about the tooltip staying visible (but unlocked) looks like something we'd want to validate and address as well. Also adding some tests would be great to have coverage.
Thanks!