feat(interaction): let brushX and zoomX pass idle hover to point focus #162
main fromrefs/pull/162/head·opened With brushX or zoomX on a plot, hovering that plot shows no point focus or tooltip. The controls cover the plot and capture every pointer event, and the host clears focus whenever the pointer is inside a control (renderer.ts). We hit this in a production app and had to move brush and zoom into a separate overview chart to keep point tooltips on the main plot.
This adds one option shared by both controls: hover?: 'capture' | 'passthrough' (ChartControlHover). The default, 'capture', keeps today's behavior.
With 'passthrough':
- Idle mouse or pen hover over the zoom surface or the empty brush area focuses the nearest point and shows its tooltip.
- The brush selection and its handles still capture hover.
- During an active pan, brush drag or touch gesture, focus clears. It returns on the next idle hover.
- Presses, clicks, wheel and keyboard stay with the control, so one click never both selects a point and starts a brush.
- After a wheel zoom, focus re-resolves at the last pointer position, including when the zoom surface took focus from a click.
It works through the existing control-containment check, via an internal passesHover(target) on control instances. There is no CSS change, and the Canvas host shares the same renderer path.
Verification:
- New brush and zoom tests cover the default,
capture,passthrough, drag suppression, focus returning after a drag, brush selection capture, and re-resolve after click then wheel. - typecheck, docs check, bundle check and benchmark check pass.
- The interactions guide gains a runnable zoom-plus-tooltip example.
Bundle cost:
- DOM host: about +34 B raw.
- Brush and zoom: about +0.3 kB raw / +0.1 kB gzip each.
- Two size limits rise by 0.01 to 0.02 kB.
Not tested: real browsers and real touch or pen devices; everything above ran under jsdom. package:check fails locally at the React 18 packed-consumer step with ERR_PNPM_PEER_DEP_ISSUES, and main fails the same way here, so this looks environmental.
Includes a minor changeset and API-FRICTION entry F-307. That ID will need renumbering if another friction entry lands first.
Summary by CodeRabbit#
- New Features
- Brush and zoom controls now support a
passthroughhover option. While the pointer is idle over eligible plot areas, nearby points can receive focus and display tooltips; the defaultcapturebehavior is unchanged. - Point focus clears during active gestures and resumes on idle hover. Brush and zoom controls retain presses, clicks, wheel input, and keyboard input; focus is refreshed after accepted wheel zoom.
- Brush and zoom controls now support a
- Documentation
- Added guidance and examples covering hover modes and interaction behavior during gestures.
- 1
🦋 Changeset detected#
Latest commit: 92b48a99d84d753a3361f4e55859ae00a8db6ce8
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 12 packages
Name Type @tanstack/charts Minor @tanstack/alpine-charts Minor @tanstack/angular-charts Minor @tanstack/lit-charts Minor @tanstack/octane-charts Minor @tanstack/preact-charts Minor @tanstack/react-charts Minor @tanstack/react-native-charts Minor @tanstack/solid-charts Minor @tanstack/svelte-charts Minor @tanstack/vue-charts Minor @tanstack/charts-scales Minor 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
Thanks Greg, I checked the unchanged runtime at 92b48a9 against current main in isolated Chromium with real mouse input. Default and explicit capture kept focus inside the control. Passthrough focused points, drag movement cleared point focus, and idle hover restored it. None of those gestures selected a chart point.
Matched production fixtures measured these gzip increases, in decimal kB:
- DOM host: 0.019 kB
- Brush and DOM host: 0.132 kB
- Zoom and DOM host: 0.113 kB
- Compact React: 0.018 kB
- React line with Canvas: 0.019 kB
- Motion renderer: unchanged
The cost summary needs a refresh. The current diff raises seven source ceilings, not two, and the zoom ceiling rises by about 0.094 kB. Those changes still need approval. The PR description also says F-307 while the actual entry is F-315, which overlaps other pending contributions.
This is bounded browser and bundle verification, not a full repository validation pass. Touch, pen, wheel behavior and packed consumers still need verification before merge.
Follow-up on 92b48a99: wheel zoom and accepted panning now pass the isolated Chromium checks too. Focus stays positioned correctly after wheel zoom, clears during a pan, and returns at the updated point position afterward. Accepted mouse pans and Chromium touch/pen input emulation all pass.
I also checked default, capture and passthrough modes for both controls with mouse, touch and pen input. Brush callbacks fire, gestures do not select chart points, and idle pen hover follows the selected mode. Touch and pen gestures were separated beyond D3’s existing 500 ms ghost-click suppression window, so this does not claim immediate mixed-device switching or physical-device coverage.
Full repository CI and the bundle-cost review are still outstanding.
Thanks @greglum, I extended verification at this same head to the full isolated checkout: all 2,232 DOM tests, the six additional framework targets, TypeScript and the documentation contract pass. The full packed-package gate also passes, including bare React Native, Expo, seven adapters and the unified artifact.
This complements the earlier input checks, but does not approve the seven proposed ceiling increases or replace required CI. Those holds remain.
Verified head:
92b48a99d84d753a3361f4e55859ae00a8db6ce8.
Sign in to join this conversation.
Warning
Review limit reached#
You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.
Next included review available in 2 minutes.
Check out review usage here.
View limit details
Limit details: You’ve used all 4 included reviews currently available.
Learn how review limits work.
Review configuration:
⚙️ Run configuration
0b10179c-8722-4304-bc7a-d5c0869eff73📥 Commits
Reviewing files that changed from the base of the PR and between 313107cd1771c6e845c0b15bdd777ddd36f48cde and 92b48a99d84d753a3361f4e55859ae00a8db6ce8.
📒 Files selected for processing: 24
.changeset/control-hover-passthrough.mdAPI-FRICTION.mdbenchmarks/bundle-size/universal-baseline.jsonbenchmarks/comparison/bundle-baseline.jsonbenchmarks/conformance/previews/manifest.jsondocs/comparison.mddocs/guides/interactions-and-selections.mddocs/reference/focus-and-interaction.mddocs/reference/index.mddocs/reference/types.mdpackages/charts-core/docs/comparison.mdpackages/charts-core/docs/guides/interactions-and-selections.mdpackages/charts-core/docs/reference/focus-and-interaction.mdpackages/charts-core/docs/reference/index.mdpackages/charts-core/docs/reference/types.mdpackages/charts-core/src/dom-types.tspackages/charts-core/src/interaction-brush.test.tspackages/charts-core/src/interaction-brush.tspackages/charts-core/src/interaction-range-internal.tspackages/charts-core/src/interaction-zoom.test.tspackages/charts-core/src/interaction-zoom.tspackages/charts-core/src/renderer.tsscripts/measure-bundles.mjsscripts/public-callback-contract.mjsNo actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
9c7390a5-fac9-43c8-9d51-02bfebf1d322📥 Commits
Reviewing files that changed from the base of the PR and between b32fb23ebf525127a2821e759fe27e87e945d40e and 313107cd1771c6e845c0b15bdd777ddd36f48cde.
📒 Files selected for processing: 17
API-FRICTION.mdbenchmarks/bundle-size/universal-baseline.jsonbenchmarks/comparison/bundle-baseline.jsonbenchmarks/conformance/previews/manifest.jsondocs/comparison.mddocs/reference/focus-and-interaction.mddocs/reference/types.mdpackages/charts-core/docs/comparison.mdpackages/charts-core/docs/reference/focus-and-interaction.mdpackages/charts-core/docs/reference/types.mdpackages/charts-core/src/dom-types.tspackages/charts-core/src/interaction-brush.test.tspackages/charts-core/src/interaction-brush.tspackages/charts-core/src/interaction-zoom.test.tspackages/charts-core/src/renderer.tsscripts/measure-bundles.mjsscripts/public-callback-contract.mjs🚧 Files skipped from review as they are similar to previous changes: 5
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
📝 Walkthrough
brushXandzoomXnow share ahoveroption. The defaultcapturemode keeps hover with the control. Thepassthroughmode forwards eligible idle hover to chart point focus while control gestures and other inputs remain control-owned.Changes: Brush and zoom hover passthrough
packages/charts-core/src/interaction-range-internal.ts,packages/charts-core/src/dom-types.ts,packages/charts-core/src/renderer.ts,scripts/public-callback-contract.mjsChartControlHoverand a resolver that defaults tocaptureand rejects other values. AddspassesHoverto host controls. The renderer honors that callback for pointer movement and focus-in events.packages/charts-core/src/interaction-brush.ts,packages/charts-core/src/interaction-zoom.ts,packages/charts-core/src/interaction-brush.test.ts,packages/charts-core/src/interaction-zoom.test.ts.changeset/control-hover-passthrough.md,API-FRICTION.md,docs/guides/interactions-and-selections.md,docs/reference/*,packages/charts-core/docs/guides/interactions-and-selections.md,packages/charts-core/docs/reference/*benchmarks/bundle-size/universal-baseline.json,benchmarks/comparison/bundle-baseline.json,benchmarks/conformance/previews/manifest.json,docs/comparison.md,packages/charts-core/docs/comparison.md,scripts/measure-bundles.mjsPriority: ⬇️ Low
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Feature
Sequence Diagram(s)#
Suggested reviewers:
tannerlinsleyMerge Risk: ⚪ Minimal · up to
31310No actionable defect was established. The change is mergeable after normal checks; real-device hover behavior remains unverified.
Security architecture risk: 🔵 Low · up to
b32fbThe change is opt-in and preserves the existing capture default. Reviewed paths retain control ownership for activation and suppress hover forwarding during active gestures. No introduced security issue was substantiated, but real-browser touch, pen and concurrent-pointer behavior remains unverified.
Retained concerns No architecture-level concerns identified.
Security review details
Security Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Pre-merge checks:
4 · 
1
Full details: Docstring Coverage
Explanation
Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 9 files. (10 skipped: 10 unsupported.)
✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share