Repository navigation
fix(Tooltip, TooltipContext): Keep tap-pinned tooltips locked, and keep flipped tooltips inside the container - #924
Conversation
…nd hide it once unlocked On touch, a tap dispatches `pointerleave` before `click`. `pointerleave` scheduled a hide, `click` then locked the tooltip, and the scheduled hide still cleared the data under the lock. The chart was left locked with nothing to show, and since the root `onclick` is only forwarded with data, no tap could unlock it. The scheduled hide now re-checks `locked`. A hide ignored while locked is now applied once unlocked. Otherwise unpinning by a tap (where the pointer has already left) or unlocking from outside the chart left the tooltip visible but unlocked, with nothing to hide it. Fixes techniq#922
…ng overflows the other edge Containment flips a tooltip that doesn't fit on one side of the pointer to the other, but never checked the other edge after the flip. A start-aligned tooltip (ex. the default `top-left`) wider than about half a narrow chart then opened past the left edge, and off screen on a phone. After the flips, the tooltip is now clamped within the edges, favoring the left/top edge when it doesn't fit either way. This applies to x and y in all four containment paths (container and window, portaled or not). Fixes techniq#923
🦋 Changeset detectedLatest commit: 3ee9f28 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
Bundle Size AnalysisUse-Case ScenariosCore (7 changed)
Base (agnostic) (4 changed)
Base (layer-specific) (3 changed)
Cartesian charts (27 changed)
Geo (3 changed)
Hierarchy (4 changed)
Graph / network (4 changed)
Components (1 changed)
Worst case (1 changed)
Understanding this report
|
techniq
left a comment
There was a problem hiding this comment.
Looks great, thanks!
Curious if you tested this locally with your setup (you can leverage the PR preview release)?
|
My pleasure, thank you for creating and maintaining such a great lib in the first place :) Before you asked, I only checked that repros and few example edge case pages built by claude work as intended; pulled now that updated pkg to the actual project and it's lit! Couldn't be happier :) will be eagerly waiting for the next release |
|
Publishing btw, related to these mobile tooltip changes, I started working on improvements a few days ago to the default anchor and offset positions when using touch (issue #485). Currently the anchor defaults to If you have any thoughts here, I'd love to here them. We have a discord server as well |
|
thanks for such a quick release! 100% agree. i ended up doing essentially the same with bottom center. though if that's helpful, a few things that we ran into (just thoughts and personal decisions):
|
here's some initial work towards #485 - initial work: https://github.com/techniq/layerchart/pull/927/changes
great points and will take some thought. I typically leverage |
|
thanks, took a quick look at it, looks great! exposed per-event though a thought on it:
and just commenting: considering that #927 branched off before this PR, seems like a rebase would break a correction to my earlier point (i was wrong): the entire thing about first frame jumping - nvm,
also, thanks for the discord invite, hopped on :) |
Closing issues #922 and #923
fix(TooltipContext): Keep a tooltip locked from
onclickon touch, and hide it once unlockedOn touch, a tap dispatches
pointerleavebeforeclick.pointerleavescheduled a hide,clickthen locked the tooltip, and the scheduled hide still cleared the data under the lock.The chart was left locked with nothing to show, and since the root
onclickis only forwardedwith data, no tap could unlock it. The scheduled hide now re-checks
locked.A hide ignored while locked is now applied once unlocked. Otherwise unpinning by a tap (where
the pointer has already left) or unlocking from outside the chart left the tooltip visible but
unlocked, with nothing to hide it.
fix(Tooltip): Keep a flipped tooltip inside the container when flipping overflows the other edge
Containment flips a tooltip that doesn't fit on one side of the pointer to the other, but never
checked the other edge after the flip. A start-aligned tooltip (ex. the default
top-left)wider than about half a narrow chart then opened past the left edge, and off screen on a phone.
After the flips, the tooltip is now clamped within the edges, favoring the left/top edge when it
doesn't fit either way. This applies to x and y in all four containment paths (container and
window, portaled or not).