Automattic / Automattic/jetpack
Charts: beside tooltip side preference is LTR-biased in RTL layouts
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
### Impact
Minor. Cosmetic only, and only visible when both sides of a bar fit the tooltip.
### Steps to reproduce
1. Render a `@automattic/jetpack-charts` BarChart with the beside tooltip on a page with `dir="rtl"` (for example the Storybook stories from #52234 with the html direction flipped).
2. Hover a bar with room on both sides.
### What I expected
In a right-to-left layout the tooltip's preferred side should mirror, so it opens toward the reading direction the way it does in left-to-right.
### What happened instead
The beside tooltip prefers the bar's right side first in RTL as well. The side preference in `BoundedTooltip` / `getBoundedPosition` is LTR-biased.
### Notes
- Pre-existing on trunk; found during the #52234 review with a real RTL hover sweep, and not introduced by that PR.
- Charts currently have no RTL mirroring at all (axes and bar order are not mirrored either), so this should be picked up together with a general RTL pass on the charts package rather than fixed in isolation.
Contributor guide
Research direction
Start with the BarChart beside tooltip flow, especially BoundedTooltip and getBoundedPosition, then reproduce the behavior in the Storybook stories from #52234 with the page direction set to RTL. Done means the tooltip preference mirrors in RTL as part of a broader RTL pass covering the charts package, rather than an isolated fix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react, storybook
- Domain
- frontend, internationalization, localization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100