-
Notifications
You must be signed in to change notification settings - Fork 97
[ACCESSIBILITY] Global changes to pass AXE/Lighthouse Audits #66
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
Conversation
|
Happy to see this happen @Austin94! Less "do as I say," more "do as I do." |
ryanseddon
left a comment
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.
Nice, so these all came out of running the styleguide through the chrome dev tools audit panel?
| expect(input).toHaveProp('aria-describedby', `${CONTAINER_ID}--hint`); | ||
| }); | ||
|
|
||
| it('excludes aria-describedby if option is provided', () => { |
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.
'excludes aria-describedby if option is not provided'
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.
Fixed. Was going to save this for the separate PR, but depending on what we view as the most common scenario, we might have this default to false.
Updated for now.
| </FieldContainer> | ||
| ); | ||
|
|
||
| expect(findInput(wrapper)).toHaveProp('aria-describedby', null); |
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.
Would this work too?
expect(findInput(wrapper)).not.toHaveProp('aria-describedby')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.
Unfortunately no. The syntax above would expect the prop to have undefined as a value, but is null as provided.
If we were to provide undefined through the render-prop it would actually show as undefined in the DOM. With null React is removing it from the attribute list.
| role, | ||
| 'aria-autocomplete': 'list', | ||
| 'aria-haspopup': 'true', | ||
| 'aria-owns': this.getMenuId(), |
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.
Does this apply when the menu is open? I can't see that anywhere.
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.
No it does not. Since we are moving focus to the menu it seems to not be required? I ran AXE across all of the states in the menu and the only thing it picked up was us appending it to the body in a "non-landmark region" which would be something a consumer would customize.
Unfortunately no. The overall scores did, but the majority of corrections were guided by the AXE plugin. It seems to be a lot more picky about things than the lighthouse audit and helped find some of the larger holes. |
| </Col> | ||
| </Row> | ||
| </Grid> | ||
| <div role="group" aria-label="State Usage Example"> |
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.
Can these attributes apply to <Grid>? In other words, make role="group" automatic with the component and apply aria-label manually.
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.
These are no added to the <Grid>
| }, | ||
| offset: { | ||
| fn: (data) => { | ||
| fn: data => { |
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.
hopefully grabbed by rebase on #65
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.
Fixed with a rebase
|
|
||
| exports[`Input renders RTL styling 1`] = ` | ||
| <input | ||
| aria-invalid={false} |
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.
Isn't {false} in these (and following) snaps unexpected?
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.
We are defaulting this to false to match the "default" state (https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-invalid_attribute).
Without any validation this would still be false. AXE didn't seem to find any issues with this.
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.
But shouldn't it be aria-invalid="false" rather than {false}? I haven't seen JSX syntax in snapshots before.
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.
nvmd. Bogus expectations on my part here. 😳
| import { zdFontSizeEpsilon, zdFontWeightSemibold } from '@zendeskgarden/css-variables'; | ||
|
|
||
| const ArgumentsContainer = styled.div` | ||
| margin-bottom: 8px; |
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.
Use xs spacing from css-variables.
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.
Fixed
| `; | ||
|
|
||
| const Heading = styled.div` | ||
| margin-bottom: 4px; |
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.
Use xxs spacing from css-variables.
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.
Fixed
| @@ -0,0 +1,90 @@ | |||
| .hljs { | |||
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.
If you can't access variables, it would be good to comment this file with selected color names from https://garden.zendesk.com/css-components/utilities/color/.
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.
I've added the equivalent color values as comments. I also updated all of the colors to match an equivalent in the palette so it should be a little clearer now.
- @zendeskgarden/react-ranges@2.2.11
eebae58 to
be32908
Compare
Oh weird I thought from this post that lighthouse actually internally uses AXE in the audit? |
ryanseddon
left a comment
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.
So next steps is to introduce smaller PRs for these changes?
I think it does, it at least linked to the dequeue links that AXE provides, but it seems to be a sub-set of the audits that the standalone plugin uses.
Yes. Probably 3-4 |
|
Closing this now that all areas have been merged separately. |
TL;DR: We have improved from an aggregate lighthouse accessibility score of 45% to 98.5% across ALL packages (with the remaining failures being lighthouse miss-fires) 🎉
Tooling Used
All three tools were used for the tests/assumptions performed during this process.
Here is a link to the lighthouse exports after the changes shown in this PR: https://drive.google.com/open?id=11bOPsxBof8gMa8Md0ZXhKzvMg0PHyVYq
These files can be viewed with https://googlechrome.github.io/lighthouse/viewer2x/
Description
Accessibility is important. All components within this repository are built to the W3C Design Patterns spec; so this means that everything is 100% accessible, right?
WRONG 😢 (this is react-buttons)
The majority of component implementations are accessible, but our examples are currently lacking some good best practices. Some of this is a combination of color-contrast issues and customizations on top of react-styleguidist, but the worst offenders currently are the handwritten examples and some invalid assumptions about menu accessibility.
Currently all examples are hovering around the 40-60% lighthouse score. This PR is a collection of several breaking API changes, styleguidist improvements, and example updates. These will be split into several individual PRs, but I felt a background PR would help.
Detail
I've split this PR into 3 commits:
Breaking (and non-breaking) API Changes
aria-describedbyaria-controlsandaria-ownscan only to reference elements that are rendered already (duh)Example updates
aria-labeland documentation changesStyleguidist upgrades
Before:

After:

Learnings
Even thought we have static accessibility linting with
jsx-a11ya large chunk of our codebase lives within the Markdown examples and isn't reachable with this tool. We should perform more frequent accessibility audits or find some additional ways of auditing this in an automated fashion.Checklist
designer as a reviewer)
component
yarn start)src/index.jsexport