fix: make tooltips to not appear off screen#269
Draft
timothygachengo wants to merge 5 commits into
Draft
Conversation
commit: |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to prevent chart tooltips from rendering off-screen by clamping tooltip positioning to the viewport, covering both React-rendered tooltips and a manual d3 tooltip path.
Changes:
- Added viewport-clamping logic for the main embeddable chart tooltip component via a new clamp helper + hook.
- Updated
ChartTooltip.jsxto use the same clamping hook for charts that use that tooltip component. - Updated the d3 tooltip positioning in
LineLayer.jsxto clamptop/leftwithin the viewport bounds.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
packages/dvz-ui/src/embeddable/chart/Tooltip.jsx |
Introduces clampTooltipToViewport + useClampTooltipToViewport and applies the ref to tooltip markup. |
packages/dvz-ui/src/embeddable/common/ChartTooltip.jsx |
Uses the shared clamping hook to keep these tooltips within viewport. |
packages/dvz-ui/src/embeddable/chart/LineLayer.jsx |
Clamps the manually-positioned d3 tooltip within the viewport. |
packages/dvz-ui/package.json |
Adds react-tooltip dependency (currently appears unused). |
pnpm-lock.yaml |
Lockfile updates for the new dependency/version graph. |
.changeset/open-rocks-move.md |
Declares a patch release describing the tooltip clamping behavior change. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
commit: |
commit: |
commit: |
timothygachengo
marked this pull request as draft
July 21, 2026 13:15
ralvarez-dg
approved these changes
Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Type of change
fix:)feat:)BREAKING CHANGE:)refactor:/chore:)docs:)Affected package(s)
@devgateway/dvz-ui-react@devgateway/wp-react-libexampleonly (no changeset needed)Checklist
pnpm changeset) for any change to a published packagepnpm buildpasses locallypnpm --filter @devgateway/* typecheckpasses