Skip to content
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

Feature/accessibility group component #1705

Merged
merged 4 commits into from
Oct 7, 2020

Conversation

ljones87
Copy link
Contributor

@ljones87 ljones87 commented Oct 6, 2020

  • Adds an AccessibilityGroupComponent to victory-core.
  • This component can be provided to the groupComponent prop to add aria-labels and desc tags with aria-describedby.
  • Also adds aria-label to groupComponent option VictoryClipContainer
  • tests

AccessibilityGroupComponent


return desc ? (
<g aria-label={this.props["aria-label"]} className={className} tabIndex={tabIndex}>
<desc aria-describedby={this.props["aria-describedby"]} id={descId}>
Copy link
Contributor

Choose a reason for hiding this comment

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

I think aria-describedby belongs on the g tag. When there is a desc, aria-describedby should use the id of the desc tag. When there isn't a desc, it should use whatever user provided id string.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok cool, yeah I didn't get a lot out of looking up aria-describedby best practice, but in looking up reading on the <desc> tag i see its placement on <desc> is redundant. Will fix


return desc ? (
<g aria-label={this.props["aria-label"]} className={className} tabIndex={tabIndex}>
<desc aria-describedby={this.props["aria-describedby"]} id={descId}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Also, when there is a desc, there needs to be a back up for if the user doesn't provide a descId

Copy link
Contributor Author

@ljones87 ljones87 Oct 7, 2020

Choose a reason for hiding this comment

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

OK found a better resource to understand the described by attribute, https://developer.paciellogroup.com/blog/2018/09/describing-aria-describedby/

as you had said, aria-describedby and descId should be identical, with aria-describedby using the descId
I am wondering if aria-describedby should even be a prop the user controls:

if(descId) => descId is required, aria-describedby will use the same input
else arial-label should suffice

error

Copy link
Contributor

@boygirl boygirl Oct 7, 2020

Choose a reason for hiding this comment

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

Hmm... I think aria-describedby should still be a prop in the case where a user wants to describe the group with some other, non-victory element. If they provide both a desc prop and a aria-describedby prop, though, the user's aria-describedby should be used to set the descId so that they definitely match. If they provide only a desc and no aria-describedby we will need to generate an id to use for both aria-describedby and descId. So, I think descId probably shouldn't be a prop.

Base automatically changed from feature/aria-label-scatter-etc to feature/aria-label October 7, 2020 18:10
@boygirl
Copy link
Contributor

boygirl commented Oct 7, 2020

@ljones87 This looks great! Good to merge, I think.

@ljones87 ljones87 force-pushed the feature/accessibility-group-component branch from b6c43ec to 1d288f6 Compare October 7, 2020 20:05
@ljones87 ljones87 merged commit 727d6c5 into feature/aria-label Oct 7, 2020
@ljones87 ljones87 deleted the feature/accessibility-group-component branch October 7, 2020 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants