FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Charts: provide an accessible title and description by dlabrecq · Pull Request #2500 · patternfly/patternfly-react · GitHub

Charts: provide an accessible title and description - #2500

Merged
redallen merged 1 commit into
patternfly:masterfrom
dlabrecq:1498-aria-props
Jul 12, 2019
Merged

Charts: provide an accessible title and description#2500
redallen merged 1 commit into
patternfly:masterfrom
dlabrecq:1498-aria-props

Conversation

dlabrecq commented Jul 11, 2019
edited
Loading

Copy link
Copy Markdown
Member

Victory provides the ability to add a description and title to SVGs for accessibility. However, users must override containerComponent just to set these properties -- it's not clear how to provide accessibility.

In order to make this more intuitive, I've added ariaDesc and ariaTitle properties to our top level components; Chart, ChartGroup, etc. The property names we chosen because ChartDonut and ChartDonutUtilization already have title and subTitle properties; thus, avoiding a breaking change.

Note that these top-level properties just pass through to the container's desc and title props. The underlying SVG refers to desc and title tags via the SVG's aria-labeledby attribute.

The approach allows users to continue using the allowZoom prop of Chart and ChartGroup without overriding containerComponent. If the user must override containerComponent, the allowZoom property would not be able to provide a default VictoryZoomContainer component.

These top-level properties also help to set desc and title for ChartPie, ChartDonut etc. Overriding containerComponent would not work in this particular case because the chart is wrapped with a ChartContainer component and rendered standalone=false -- required to show title, subTitle, and legend within the same SVG. The desc and title properties must be applied to the outermost container.

Example output:

Fixes #1498

Copy link
Copy Markdown
Collaborator

PatternFly-React preview: https://patternfly-react-pr-2500.surge.sh

Copy link
Copy Markdown
Contributor

Conflicts with #2497 which just went in.

dlabrecq force-pushed the 1498-aria-props branch 3 times, most recently from 6c3225c to 1741fcc Compare July 11, 2019 15:03
tlabaj requested review from TheRealJon and jcaianirh July 11, 2019 15:09
tlabaj assigned jcaianirh and jessiehuff and unassigned jcaianirh Jul 11, 2019
tlabaj added the PF4 label Jul 11, 2019

tlabaj commented Jul 11, 2019

Copy link
Copy Markdown
Contributor

@dlabrecq can you please link associated issue. Thanks

jschuler left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Maybe down to personal preference, but I would drop Label from the props and name them just ariaDesc and ariaTitle. Otherwise it looks good

Copy link
Copy Markdown
Member Author

Thanks @jschuler . I've renamed those properties as ariaDesc and ariaTitle.

tlabaj added the A11y label Jul 11, 2019
tlabaj requested a review from jgiardino July 11, 2019 17:24
dlabrecq force-pushed the 1498-aria-props branch 3 times, most recently from 3d1cbf0 to 7e0537d Compare July 11, 2019 18:12
redallen merged commit 0e5ac2b into patternfly:master Jul 12, 2019

Copy link
Copy Markdown
Collaborator

Your changes have been released in:

  • @patternfly/react-charts@4.6.0

Thanks for your contribution! 🎉

mattnolting left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think this is a great start to making chart visuals accessible! To @jgiardino's point, the visual representation benefits from a title and desc. However, the data presented is not traversable, which presents a broader issue. Some possible approaches are adding role="group" to charts, then selectively adding role="presentation" to elements we want to hide from SRs. Another is to generate a hidden table that contains the data represented visually. Either way, that's a different issue. Just found two issues with desc in area charts.

<div className="area-chart-legend-bottom">
<Chart
ariaDesc="Average number of pets"
ariaTitle="Donut chart example"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Should be "Area chart example"

<div className="area-chart-legend-bottom-responsive">
<Chart
ariaDesc="Average number of pets"
ariaTitle="Donut chart example"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Should be "Area chart example"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thank you. I'll create a PR to fix the title text.

Copy link
Copy Markdown
Contributor

@mattnolting Created relevant issue and followup PR for you.

dlabrecq deleted the 1498-aria-props branch July 17, 2019 17:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Charts - provide an accessible title and description

8 participants


Back | FazBrowse Home | New Git URL