Skip to content

Charts: Fix hidden legend items showing through chart tooltips - #55532

Open
chihsuan wants to merge 3 commits into
trunkfrom
change/wooa7s-2544-legend-over-tooltip
Open

chihsuan wants to merge 3 commits into
trunkfrom
change/wooa7s-2544-legend-over-tooltip

Conversation

@chihsuan

Copy link
Copy Markdown
Member

Fixes WOOA7S-2544

Proposed changes

Fix a hidden legend item, such as Prev. 7 days, showing on top of a chart tooltip that reaches down over the legend. Visible legend items were already covered.

The cause: a dimmed legend item is its own paint layer, and it comes after the plot, so it painted over the plot's tooltip. The plot now sits above its legend, and the chart as a whole is isolated instead of just the plot, so a sticky page header still paints over the chart and its tooltip.

This is in the shared chart layout of @automattic/charts, so every bar, line and area chart gets it. Line chart annotations stay above the plot, and pie, semi-circle and heatmap charts drop their own isolation, which the layout now provides.

Before After
Before: the struck-through Prev. 7 days legend item shows through the bottom of the tooltip After: the tooltip covers the whole legend

Notice the bottom row of the tooltip: before, Prev. 7 days paints through it. The visible Views and Visitors items are covered in both.

Related product discussion/links

Does this pull request change what data or activity we track or use?

No.

Testing instructions

Setup

  1. Check out this branch, run pnpm install, then start the monorepo Storybook: cd projects/js-packages/storybook && pnpm run storybook:dev.

Hidden legend item under the tooltip

  1. Open Packages › Premium Analytics › Widgets › TrafficChart › With Comparison. Prev. 7 days is hidden in the legend.
  2. In the inspector, select the white widget card and give it width: 260px; height: 265px, so the tooltip reaches the legend.
  3. Hover the top of the first bar. Confirm the tooltip covers the struck-through Prev. 7 days item completely. On trunk the item shows through the tooltip.
  4. Repeat on TrafficChart › Line Chart With Comparison. Confirm the same.

Page chrome still paints over the chart

  1. On the same story, with the tooltip open, run this in the story frame's console to add a fixed header across the tooltip:
    const h = document.createElement('div'); Object.assign(h.style, { position: 'fixed', left: 0, right: 0, top: document.querySelector('.visx-tooltip').getBoundingClientRect().top + 20 + 'px', height: '40px', background: 'gold', zIndex: 1 }); document.getElementById('storybook-root').prepend(h);
  2. Hover the same bar again. Confirm the gold header paints over the tooltip.

Annotations and other charts

  1. Open JS Packages › Charts Library › Charts › Line Chart › Annotations › Alert and click the red alert icon. Confirm its popover opens.
  2. Hover the Pie Chart › With Tooltips, Pie Semi Circle Chart › With Tooltips and Heatmap Chart › Default stories. Confirm the tooltips show as on trunk.

@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack or WordPress.com Site Helper), and enable the change/wooa7s-2544-legend-over-tooltip branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack change/wooa7s-2544-legend-over-tooltip
bin/jetpack-downloader test jetpack-mu-wpcom-plugin change/wooa7s-2544-legend-over-tooltip

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions Bot added [JS Package] Charts [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Premium Analytics [Plugin] Stats Data RNA labels Nov 27, 2026
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: December 8, 2026
    • Code freeze: December 7, 2026

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Premium Analytics plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Stats Data plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@jp-launch-control

Copy link
Copy Markdown

Code Coverage Summary

This PR did not change code coverage!

That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷

Full summary · PHP report · JS report

@chihsuan
chihsuan marked this pull request as ready for review November 27, 2026 05:37
@chihsuan
chihsuan requested a review from a team November 27, 2026 05:37
@chihsuan chihsuan added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Nov 27, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[JS Package] Charts [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Premium Analytics [Plugin] Stats Data RNA [Status] Needs Review This PR is ready for review. [Type] Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant