Repository navigation
Charts: Fix leaderboard overlay labels losing their padding in right-to-left languages - #54192
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
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:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryThis 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. 🤷 |
louwie17
left a comment
There was a problem hiding this comment.
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.
b13f5a9 to
4eb0efd
Compare
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.
--a8c-charts-dimension-leaderboard-label-insetcatalog 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-focusrather 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 storybookinprojects/js-packages/charts).Right to left
dir="rtl"to<html>in the story frame. Confirm each label keeps a gap from the bar's start edge instead of touching it.dir. Confirm left-to-right looks the same as on trunk.Override
--a8c-charts-dimension-leaderboard-label-inset: 24pxon the.a8c-charts-scopeelement. 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.