Repository navigation
Premium Analytics: Name each widget chart for screen readers - #53333
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! Jetpack 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. Boost 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. Social 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. Videopress 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. Wpcomsh plugin:
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. |
969e802 to
89bf1ba
Compare
2ef0641 to
aa38faf
Compare
aa38faf to
ce2a2da
Compare
The charts package can now name a chart for screen readers. The toolkit wrappers dropped the prop, so widgets had no way to supply a name.
Screen reader users can tell the dashboard's charts apart.
Screen reader users can tell the dashboard's charts apart.
Screen reader users on the package and both plugins that ship the dashboard need to see the fix in their changelogs.
Atomic sites reach the Premium Analytics dashboard through wpcomsh, so its users need the entry too.
The tabbed branch passes ariaLabel separately and production widgets use it, so it needs its own coverage; the READMEs and a redundant default are tidied alongside.
The dropdown branch passes ariaLabel separately from the tabs branch, so it needs its own coverage, which the mocked resize observer can now reach by reporting a width.
The chart's role is application, so a screen reader never says it is a chart, and a bare widget title repeats the name of the section around it. The wrappers now take chartTitle and build the name through one translatable string, so each locale can place the word for chart where its grammar needs it.
096d632 to
20ee1c2
Compare
ce2a2da to
d6007f0
Compare
Fixes https://linear.app/a8c/issue/STATS-521
Why
On the Premium Analytics dashboard, a screen reader announces every line and bar chart as just "Line chart" or "Bar chart", so a user moving through a dashboard of a dozen widgets cannot tell which chart they are on. After this PR, each chart is announced by its widget's title, such as "Traffic summary chart" or "Sales by device chart".
The word "chart" is part of the name because the chart's role is
application, so nothing else tells a screen reader user it is a chart. It also keeps the chart's name from repeating the name of the widget section around it.Proposed changes
ComparativeLineChart,ComparativeBarChart, the toolkitBarChartandMetricTabsChart) take an optionalchartTitle. The leaf wrappers name the chart through one translatable%s chartstring, so each locale can put the word where its grammar needs it. Without a title, the chart keeps its default name.ComparativeLineChartno longer accepts the charts package'sariaLabel, which it took in its type but dropped.widget.json: Author performance, Email performance, Post views, Store performance, Subscriber summary, Traffic summary, Video performance, Revenue by customer type, Bookings revenue by customer type, Sales by coupon, Sales by coupon usage, Sales by device, Bookings by device and Total returns. Widgets that share one component each get their own title.BarChartalso asserts that no title keeps the default.MetricTabsChartis covered in all three layouts (single metric, tabs and the narrow dropdown) for both chart types. The shared@wordpress/composetest mock can now report a width, which is how the dropdown test is reached.Stacked on #53202, which adds
ariaLabelto the charts package's line, area and bar charts; retarget totrunkonce it merges. The pie, semi-circle and donut widgets follow in this PR after #53274 (CHARTS-251) merges.Related product discussion/links
@wordpress/widget-primitives, so widgets can stop repeating their title in__().Does this pull request change what data or activity we track or use?
No.
Testing instructions
role="application") and open the Accessibility pane. Confirm its name is the widget's title followed by "chart", such as "Traffic summary chart", not "Line chart" or "Bar chart".Verified locally: the Premium Analytics test suite and typecheck pass.
🤖 Generated with Claude Code
https://claude.ai/code/session_01EtJ3LkpDhDoFRY6BpADpoU