Skip to content

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

Merged
merged 24 commits into from
Jan 17, 2018
Merged

Accessibility fixes (and tests) #1227

merged 24 commits into from
Jan 17, 2018

Conversation

sorin-davidoi
Copy link
Contributor

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!

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.
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,
Copy link
Contributor Author

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.

Copy link
Member

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.

@sorin-davidoi
Copy link
Contributor Author

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".
@sorin-davidoi sorin-davidoi changed the title Accessibility fixes Accessibility fixes (and tests) Jan 10, 2018
</form>

<div id="main" class='inner-content'>
<main id="main" class='inner-content'>
Copy link
Contributor Author

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.

@carols10cents
Copy link
Member

Thank you so much for this!!!!!! I'm taking a look now!!

@@ -1,4 +1,4 @@
<ul>
<ol>
Copy link
Member

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 ols 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 divs rather than uls right now that should also perhaps be ols, 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

Copy link
Contributor Author

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.

Copy link
Member

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!

@@ -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">
Copy link
Member

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"}}
Copy link
Member

@carols10cents carols10cents Jan 14, 2018

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 :)

Copy link
Contributor Author

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.

@@ -104,7 +104,7 @@
{{/if}}
{{/if}}
</div>
<div class='authorship'>
<section class='authorship' aria-label="Authorship">
Copy link
Member

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; }
Copy link
Member

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.

Copy link
Member

@carols10cents carols10cents left a 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.

Copy link
Member

@carols10cents carols10cents left a 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 :)

</footer>

<a href='https://github.com/rust-lang/crates.io' class='fork-me'>
<img src='/assets/forkme.png'/ alt="Fork me on GitHub">
Copy link
Member

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!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

@carols10cents carols10cents left a comment

Choose a reason for hiding this comment

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

Thank you!!

@carols10cents
Copy link
Member

bors: r+

bors-voyager bot added a commit that referenced this pull request Jan 17, 2018
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!
@bors-voyager
Copy link
Contributor

bors-voyager bot commented Jan 17, 2018

Build succeeded

@bors-voyager bors-voyager bot merged commit 0682d78 into rust-lang:master Jan 17, 2018
@sorin-davidoi sorin-davidoi deleted the small-fixes branch January 17, 2018 20:24
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