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 :) |
##### [v2.5.1](https://github.com/techniq/layerchart/releases/tag/layerchart%402.5.1) ##### Patch Changes - fix(Tooltip): Keep a flipped tooltip inside the container (or window) when flipping overflows the other edge (ex. a start-aligned tooltip wider than half a narrow chart opened past its left edge) ([#924](techniq/layerchart#924)) - fix(TooltipContext): Keep a tooltip locked from `onclick` on touch (a tap's `pointerleave` precedes `click`, and its pending hide cleared the data under the lock), and hide it once unlocked if the pointer left while locked ([#924](techniq/layerchart#924)) ##### [v2.5.0](https://github.com/techniq/layerchart/releases/tag/layerchart%402.5.0) ##### Minor Changes - feat(Group|Hull|Rule): Support `seriesKey` prop to fade the mark while another series is highlighted and remove it while the legend has that series hidden ([#917](techniq/layerchart#917)) ##### [v2.4.1](https://github.com/techniq/layerchart/releases/tag/layerchart%402.4.1) ##### Patch Changes - fix(deps): Bump `@layerstack/*` dependencies to fix `Package subpath is not defined by exports` when bundling without Vite (issue [#913](techniq/layerchart#913)) ([#915](techniq/layerchart#915)) - fix(Spline): Render `startContent`, `endContent`, `markerStart`, and `markerEnd` once per line rather than once per style-split segment ([#914](techniq/layerchart#914)) - fix(Spline): Keep the line's color on segments split by a `class`, `opacity`, or `fill` function ([#914](techniq/layerchart#914)) - fix(Spline): Animate segments split by a style function, which `motion` previously skipped ([#914](techniq/layerchart#914)) ##### [v2.4.0](https://github.com/techniq/layerchart/releases/tag/layerchart%402.4.0) ##### Minor Changes - feat(Axis): Add `tickOcclusion` to drop ticks whose labels would overlap, measured at the size they render (including rotation), with `priority` of `'end'` (default), `'start'`, or `'start-end'` to choose which survive ([#909](techniq/layerchart#909)) - feat(utils): Add `rotate` and multiline support to `getTextRect`, so a rotated or stacked `<Text>` can be measured for `occlude` without the caller reproducing `<Text>`'s pivot ([#909](techniq/layerchart#909)) ##### Patch Changes - fix(Area): Apply `mask`, `filter`, and `clip-path` to the `line` path as well as the fill (unless overrideden by `line={{...}}`) ([#909](techniq/layerchart#909)) - fix(Calendar): Adjust month labels after recent Text verticalAnchor improvements ([#909](techniq/layerchart#909)) - fix(Calendar): Size cells to fit `monthPath`, which can extend past the last cell when the range ends mid-month ([#909](techniq/layerchart#909)) - perf(Chart): Measure the container before building the subtree, so marks are only built once ([#909](techniq/layerchart#909)) - fix(downloadImage, downloadSvg): Inline `stop-color`/`stop-opacity` so gradients don't export as solid black ([#909](techniq/layerchart#909)) - fix(Chart): Return `undefined` from `xGet`/`yGet` when that axis has no accessor, instead of throwing `accessor is not a function` ([#909](techniq/layerchart#909)) - fix(Spline, Area): Animate each path when the mark is split by `z`, which `motion` previously skipped — segments split by a style function are still redrawn outright ([#909](techniq/layerchart#909)) - fix(Path, Spline): Render `endContent` without a `draw` transition ([#909](techniq/layerchart#909)) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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).