Skip to content

fix tooltip clipped on single-class chart#1705

Merged
ikondrat merged 5 commits into
mainfrom
fix/lig-10233-barchart-tooltip-clipped
Jul 22, 2026
Merged

fix tooltip clipped on single-class chart#1705
ikondrat merged 5 commits into
mainfrom
fix/lig-10233-barchart-tooltip-clipped

Conversation

@ikondrat

@ikondrat ikondrat commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

What has changed and why?

Fixes LIG-10233: the popover/tooltip is not visible when hovering a class distribution bar chart that has a single class.

Root cause: the vertical BarChart only sets overflow-x-auto on its scroll container (no explicit overflow-y). Per the CSS overflow spec, once one axis gets a value other than visible, the browser forces the other axis to become auto too — so the container clips vertically as well, even though only horizontal scroll was intended. ECharts renders its tooltip by default as a DOM element positioned inside that same container. With a single class, the bar nearly fills the chart's height budget, so the tooltip pops up right at the top edge and gets clipped by that implicit vertical overflow. With several bars of varying height the effect is much less visible, which is why it surfaced specifically on the single-class case.

Fix: set appendToBody: true on the tooltip in buildEchartsOption.ts. This is a standard ECharts option that renders the tooltip as a position: fixed element attached to document.body, escaping any ancestor overflow containers. Histogram/buildHistogramOption.ts already works around a related-but-different issue with confine: false (keeps the tooltip from being repositioned back inside the viewport) — that option does not address clipping by an ancestor's overflow.

No dependencies added; single-file, ~9-line change.

How has it been tested?

  • Manually traced the CSS overflow interaction and ECharts tooltip DOM placement against the BarChart.svelte / buildEchartsOption.ts source and the existing singleClass Storybook fixture (BarChart.stories.svelte → "Single class" story) that reproduces the reported layout.
  • npx prettier --check on the changed file: clean.
  • npx eslint on the changed file: clean.
  • Could not run npm run test:unit for this file in this environment: it transitively imports the generated API client ($lib/api/lightly_studio_local), which is generated from a running backend (make start in lightly_studio) that wasn't available here. This is pre-existing environment setup, unrelated to the change itself.

Did you update CHANGELOG.md?

  • Yes

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue where the Class distribution bar chart tooltip could be clipped when the chart had only one class.
    • Tooltips now render fully, including in constrained-height/overflow containers.

Klusha (OpenClaw agent) and others added 2 commits July 21, 2026 10:53
Vertical BarChart only sets overflow-x-auto on its scroll container.
Per the CSS overflow spec, an overflow-x other than 'visible' forces
overflow-y to also become 'auto', so the container clips vertically
too. With few bars (e.g. a single class) the bar nearly fills the
height budget and ECharts' default in-container tooltip renders near
the top edge, getting clipped by that implicit vertical overflow.

Fix: set appendToBody on the tooltip so ECharts renders it as a
position:fixed element attached to document.body, escaping any
ancestor overflow containers.
@ikondrat
ikondrat requested a review from a team as a code owner July 21, 2026 11:17
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 462c127a-4285-47c8-a8f7-368a4ef1875d

📥 Commits

Reviewing files that changed from the base of the PR and between d54bc78 and 2beb8b0.

📒 Files selected for processing (1)
  • CHANGELOG.md

📝 Walkthrough

Walkthrough

ECharts bar chart tooltips are appended to document.body to avoid chart-container clipping. The Unreleased changelog records the fix for single-class class distribution charts.

Changes

Bar chart tooltip overflow fix

Layer / File(s) Summary
Tooltip rendering and release notes
lightly_studio_view/src/lib/components/BarChart/buildEchartsOption.ts, CHANGELOG.md
ECharts tooltips render in document.body, and the changelog documents the single-class tooltip clipping fix.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Suggested reviewers: igorsusmelj

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main fix: preventing a clipped tooltip on single-class bar charts.
Description check ✅ Passed The description follows the template and includes the change summary, testing notes, and changelog update.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/lig-10233-barchart-tooltip-clipped

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

Comment @coderabbitai help to get the list of available commands.

@CLAassistant

CLAassistant commented Jul 21, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ ikondrat
❌ Klusha (OpenClaw agent)


Klusha (OpenClaw agent) seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9ba15059a1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lightly_studio_view/src/lib/components/BarChart/buildEchartsOption.ts Outdated
Addresses review feedback from chatgpt-codex-connector on PR #1705:
ECharts 6.1.0 (locked frontend dependency) marks appendToBody as
deprecated in favor of appendTo: 'body'. Same behavior, non-deprecated
API.
@ikondrat

Copy link
Copy Markdown
Contributor Author

/review

Comment thread lightly_studio_view/src/lib/components/BarChart/buildEchartsOption.ts Outdated
@ikondrat
ikondrat added this pull request to the merge queue Jul 21, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to invalid changes in the merge commit Jul 21, 2026
@ikondrat ikondrat changed the title fix(BarChart): tooltip clipped on single-class chart (LIG-10233) fix tooltip clipped on single-class chart Jul 21, 2026
@ikondrat
ikondrat enabled auto-merge July 22, 2026 07:32
@lightly-fast-track-bot

Copy link
Copy Markdown

❌ Fast Track: checks did not pass

Failed guardrails: frontend/complexity (Guardrail threw: Cannot find module 'eslint'
Require stack:

  • /home/runner/work/lightly-studio/lightly-studio/lightly_studio_view/package.json), frontend/coverage ( [FAIL] lightly_studio_view/src/lib/components/BarChart/buildEchartsOption.ts: coverage data not found)
Guardrail Result Message
dummy Always passes.
frontend/complexity Guardrail threw: Cannot find module 'eslint' Require stack: - /home/runner/work/lightly-studio/lightly-studio/lightly_studio_view/package.json
backend/complexity 0 file(s) checked.
backend/coverage 0 file(s) checked.
diff-size PR adds 2 line(s) (limit: 215).
frontend/coverage [FAIL] lightly_studio_view/src/lib/components/BarChart/buildEchartsOption.ts: coverage data not found

Reflects 2beb8b0.

@ikondrat
ikondrat added this pull request to the merge queue Jul 22, 2026
Merged via the queue into main with commit 2191789 Jul 22, 2026
20 of 21 checks passed
@ikondrat
ikondrat deleted the fix/lig-10233-barchart-tooltip-clipped branch July 22, 2026 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants