feat(a11y): add alt text for all chart types #1118
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1118 +/- ##
==========================================
+ Coverage 72.26% 72.65% +0.38%
==========================================
Files 387 404 +17
Lines 12021 12342 +321
Branches 2629 2671 +42
==========================================
+ Hits 8687 8967 +280
- Misses 3309 3342 +33
- Partials 25 33 +8
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
markov00
left a comment
There was a problem hiding this comment.
Few missing things that needs to be fixed
src/chart_types/heatmap/renderer/canvas/connected_component.tsx
Outdated
Show resolved
Hide resolved
markov00
left a comment
There was a problem hiding this comment.
LGTM, I've pushed a slight change on the wordcloud to move the ScreenReaderSummary out of the SVG and changed the svg role to presentation as done in the other canvases
# [29.2.0](v29.1.0...v29.2.0) (2021-05-25) ### Bug Fixes * **legend:** disable handleLabelClick for one legend item ([#1134](#1134)) ([a7242af](a7242af)), closes [#1055](#1055) ### Features * **a11y:** add alt text for all chart types ([#1118](#1118)) ([9e42229](9e42229)), closes [#1107](#1107) * **legend:** specify number of columns on floating legend ([#1159](#1159)) ([c2e4652](c2e4652)), closes [#1158](#1158) * simple screenspace constraint solver ([#1141](#1141)) ([eb11480](eb11480))
|
🎉 This PR is included in version 29.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [29.2.0](elastic/elastic-charts@v29.1.0...v29.2.0) (2021-05-25) ### Bug Fixes * **legend:** disable handleLabelClick for one legend item ([opensearch-project#1134](elastic/elastic-charts#1134)) ([e485174](elastic/elastic-charts@e485174)), closes [opensearch-project#1055](elastic/elastic-charts#1055) ### Features * **a11y:** add alt text for all chart types ([opensearch-project#1118](elastic/elastic-charts#1118)) ([e1c7489](elastic/elastic-charts@e1c7489)), closes [opensearch-project#1107](elastic/elastic-charts#1107) * **legend:** specify number of columns on floating legend ([opensearch-project#1159](elastic/elastic-charts#1159)) ([ed3736e](elastic/elastic-charts@ed3736e)), closes [opensearch-project#1158](elastic/elastic-charts#1158) * simple screenspace constraint solver ([opensearch-project#1141](elastic/elastic-charts#1141)) ([af9dd96](elastic/elastic-charts@af9dd96))
Summary
Fixes #1107
There has been great alternative text improvements for cartesian charts and this PR aims to bridge the gap with the other chart types.
The new default with charts (in terms of a11y)
This is a mixed chart (line, bar and area series). Nothing has been configured. In the video below, you can see that a dd element is generated with the following content. This is readable by a screen reader:
defaultMixedChart.mp4
If you have one type of chart, the generated text will be something like:
Adding a a11y description and disabling the default
Using the same chart as an example, you can add your own custom description for a screen reader user. Use the
ariaDescriptionprop on theSettingscomponent.In this example below, the autogenerated description is also disabled by setting the
ariaUseDefaultSummaryto false. TheariaUseDefaultSummaryprop defaults to true, and you can always include your own description as well as the default one.with.custom.description.with.default.turned.off.mp4
Setting the heading level of the screen reader description
You can also change the heading level (instead of
<p>as the default seen in the above video) by passing theariaLabelHeadingLevelto theSettingscomponent. Valid options are "h1", "h2", "h3", "h4", "h5", "h6", or "p".Setting your own aria-labels, aria-labelledby/aria-describedby properties on charts
Within the
Settingscomponent, you can add your own aria-label on the figure surrounding the chart element. Use theariaLabelprop on theSettingscomponent. You can also set thearia-describedbywith theariaDescribedByprop or thearia-labeledbywith theariaLabelledByprop to tie the charts to other accessible elements within your app.Checklist