-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few missing things that needs to be fixed
src/chart_types/heatmap/renderer/canvas/connected_component.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
ariaDescription
prop on theSettings
component.In this example below, the autogenerated description is also disabled by setting the
ariaUseDefaultSummary
to false. TheariaUseDefaultSummary
prop 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 theariaLabelHeadingLevel
to theSettings
component. 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
Settings
component, you can add your own aria-label on the figure surrounding the chart element. Use theariaLabel
prop on theSettings
component. You can also set thearia-describedby
with theariaDescribedBy
prop or thearia-labeledby
with theariaLabelledBy
prop to tie the charts to other accessible elements within your app.Checklist