Skip to content

Charts: Fix leaderboard overlay labels losing their padding in right-to-left languages - #54192

Merged
chihsuan merged 2 commits into
trunkfrom
change/charts-307-leaderboard-label-inset
Oct 29, 2026
Merged

chihsuan merged 2 commits into
trunkfrom
change/charts-307-leaderboard-label-inset

Conversation

@chihsuan

@chihsuan chihsuan commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Part of CHARTS-307

Proposed changes

Fix leaderboard overlay labels losing their padding in right-to-left languages. The label was padded on the physical left, so in right-to-left the text touched the bar's edge.

  • Pad the overlay label on its inline start.
  • Expose that padding as the --a8c-charts-dimension-leaderboard-label-inset catalog role, so content outside the chart, such as a column header, can line up with the row text without restating the value.

The focus-ring space each row reserves stays on --wpds-border-width-focus rather than becoming a chart role, so an override cannot shrink the focus ring (as decided in CHARTS-201).

Related product discussion/links

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

No.

Testing instructions

Setup: run Storybook from this branch (pnpm run storybook in projects/js-packages/charts).

Right to left

  1. Open JS Packages / Charts Library / Charts / Leaderboard Chart › With Overlay Label.
  2. In devtools, add dir="rtl" to <html> in the story frame. Confirm each label keeps a gap from the bar's start edge instead of touching it.
  3. Remove dir. Confirm left-to-right looks the same as on trunk.

Override

  1. In devtools, set --a8c-charts-dimension-leaderboard-label-inset: 24px on the .a8c-charts-scope element. Confirm every overlay label moves inward, in both directions.

Screenshots

Right to left, measured in the Premium Analytics leaderboard story. Before: labels touch the bar's edge. After: they keep their inset.

Before After
Before: right-to-left labels touch the bar edge After: right-to-left labels keep their inset

@chihsuan
chihsuan added this pull request to stack #54194 October 28, 2026 06:50
@chihsuan chihsuan self-assigned this Oct 28, 2026
@chihsuan chihsuan changed the title change/charts 307 leaderboard label inset Charts: Fix leaderboard overlay labels losing their padding in right-to-left languages Oct 28, 2026
@github-actions

github-actions Bot commented Oct 28, 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/charts-307-leaderboard-label-inset branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack change/charts-307-leaderboard-label-inset
bin/jetpack-downloader test jetpack-mu-wpcom-plugin change/charts-307-leaderboard-label-inset

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

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!

@jp-launch-control

jp-launch-control Bot commented Oct 28, 2026 •

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 October 28, 2026 07:35
@chihsuan chihsuan added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Oct 28, 2026
@chihsuan
chihsuan requested a review from a team October 28, 2026 07:35

@louwie17 louwie17 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @chihsuan, this tested well and code looks good!

Tested on a local Docker site against trunk. Since Premium Analytics renders its own label, I dropped a default overlay row into the Stats v2 dashboard to check the built charts CSS. In RTL the label went from touching the bar on trunk to keeping its 8px inset, LTR is unchanged, and setting the role to 24px moves it inward in both directions. The chart scope and leaderboard tests pass too.

LGTM 🚀

Co-reviewed and tested with Claude and Codex.

@chihsuan
chihsuan force-pushed the change/charts-307-leaderboard-label-inset branch from b13f5a9 to 4eb0efd Compare October 29, 2026 04:27
@chihsuan
chihsuan merged commit fbb9245 into trunk Oct 29, 2026
132 of 175 checks passed
@chihsuan
chihsuan deleted the change/charts-307-leaderboard-label-inset branch October 29, 2026 05:28
@github-actions github-actions Bot removed the [Status] Needs Review This PR is ready for review. label Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants