-
Notifications
You must be signed in to change notification settings - Fork 640
Accessibility fixes (and tests) #1227
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
Labels are hidden, but still accessible for screen readers (https://webaim.org/techniques/css/invisiblecontent/#absolutepositioning).
When using tab to navigate between focusable elements, it does not make sense to have two adjacent links pointing to the same address. Another solution would be to place the img tag inside the second address tag, but that leads to some style issue so I have opted for this approach instead.
Focusable elements should have a focus style, but that is overwritten. This will reuse the style applied on hover for focus.
Browsers which do not support these tags will fallback to interpreting them as divs. Ideally, the nav should be a header with a nav inside, but since the header only contains navigation link, I have omitted it and just used nav.
Will aid screen reader users find the content faster.
Semantically, the crates are sorted by time, so usage of ul is incorrect.
It is important not to break the focus order users expect. https://dequeuniversity.com/rules/axe/2.6/tabindex
Focusable elements need to have a focus style (http://www.outlinenone.com/).
It does not really make sense for it to be the first button in the tab order, since it is not one of the main actions.
export default { | ||
rules: { | ||
'color-contrast': { | ||
enabled: 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.
There are multiple elements that currently fail this test. I have disabled it since I think it needs to be addressed by someone more inclined towards design.
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 opened a new issue for addressing these.
I have integrated ember-a11y-testing in order to avoid these problems from appearing again. |
…opment This will prevent the violations from being highlighted on the page, which is annoying since the color-contrast rule is currently disabled during tests and thus a lot of elements would be highlighted. https://github.com/ember-a11y/ember-a11y-testing#development-usage
Screen readers can announce to the user when the section has finished loading. The loaders were missing the alt attribute, but instead of adding it I have moved they to CSS, since the content of the section is not (normally) available to screen readers when aria-busy="true".
</form> | ||
|
||
<div id="main" class='inner-content'> | ||
<main id="main" class='inner-content'> |
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.
This is not ideal since each page should define it's own main
- but I'm not familiar enough with the pages and don't have time to go through them all, so I think this is good enough for now.
Thank you so much for this!!!!!! I'm taking a look now!! |
@@ -1,4 +1,4 @@ | |||
<ul> | |||
<ol> |
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.
Should keyword-list and category-list be changed to ol
s too? They're both ordered by popularity, and those components are only used on the home page.
What about crate-downloads-list? This is used on the currently-logged-in user's dashboard and are ordered by recent downloads.
Not sure how far we should go with this in this PR-- there are lists of crates that are just div
s rather than ul
s right now that should also perhaps be ol
s, like every list of crates (which should always have SOME order) or the list of Latest Updates of crates you're following on your dashboard
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.
Yes, probably those need to be updated as well. Would rather do it in a follow-up PR if that's OK.
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.
Yup, that's totally fine!
app/templates/application.hbs
Outdated
@@ -2,7 +2,7 @@ | |||
{{google-jsapi}} | |||
|
|||
<a href='https://github.com/rust-lang/crates.io' class='fork-me'> | |||
<img src='/assets/forkme.png'/> | |||
<img src='/assets/forkme.png'/ alt="Fork me on GitHub"> |
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 think the slash after the src
attribute is to close the tag, so should go after the alt
attribute.
@@ -74,7 +74,7 @@ | |||
<code id="crate-toml">{{ crate.name }} = "{{ currentVersion.num }}"</code> | |||
|
|||
{{#if (is-clipboard-supported)}} | |||
{{#copy-button clipboardTarget="#crate-toml" success=(action 'copySuccess') error=(action 'copyError')}} | |||
{{#copy-button clipboardTarget="#crate-toml" success=(action 'copySuccess') error=(action 'copyError') title="Copy to clipboard"}} | |||
{{svg-jar "copy" alt="Copy to clipboard"}} |
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.
The title on the button isn't repetitive with the alt text on the svg inside the button? I really don't know how screenreaders will read this, just wanted to point it out :)
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.
aXe flagged this as an error, and Orca (the screen reader I test with) didn't read the text from the svg.
app/templates/crate/version.hbs
Outdated
@@ -104,7 +104,7 @@ | |||
{{/if}} | |||
{{/if}} | |||
</div> | |||
<div class='authorship'> | |||
<section class='authorship' aria-label="Authorship"> |
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.
This class being named "authorship" is kind of... out of date. There's a lot more metadata in this crate than just the author. Not sure what a better label would be- "Crate info"? "Crate metadata"?
@@ -111,7 +111,7 @@ button.small { | |||
line-height: 20px; | |||
} | |||
|
|||
> div { margin: 0 15px; } | |||
> section { margin: 0 15px; } |
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 think the div
on line 146 of this file needs to be updated to a section
as well, otherwise the columns on the home page take up a variable amount of width when they should be taking up ~1/3 of the width, which starts happening at this commit.
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.
Thank you so much for doing this important work that has been neglected for far too long!!!! I'm really excited to get these changes in. I just have a few places I commented that need some small tweaks before we can merge, and there's one spot I have a question about how many other places we should be using ol
, but I don't necessarily want to hold up this whole PR on those changes if it seems like that'll be a bigger change.
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.
Just one more tiny change :)
app/templates/application.hbs
Outdated
</footer> | ||
|
||
<a href='https://github.com/rust-lang/crates.io' class='fork-me'> | ||
<img src='/assets/forkme.png'/ alt="Fork me on GitHub"> |
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.
Just one more thing, github hid my comment on this because I made it on a commit and not the overall diff-- could you move the slash that's now between the src
and the alt
attributes to the end of the img
tag so that it closes the tag? Then this PR should be good to go!
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.
@carols10cents Done!
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.
Thank you!!
bors: r+ |
1227: Accessibility fixes (and tests) r=carols10cents Most commits have a message explaining why I think the change is necessary. Let me know if anything is unclear or if I should follow up with other changes. Shoutout to @chriskrycho for his talk [Becoming a Contributor](https://www.youtube.com/watch?v=Abu2BNixXak) which encouraged me to do this!
Build succeeded |
Most commits have a message explaining why I think the change is necessary. Let me know if anything is unclear or if I should follow up with other changes.
Shoutout to @chriskrycho for his talk Becoming a Contributor which encouraged me to do this!