Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upchore(accessibility): Add aria attributes to aid screen reader flow #117
Conversation
| @@ -1,5 +1,6 @@ | |||
| <div class="docs-component-category-list"> | |||
| <md-card | |||
| role="link" | |||
jelbourn
Mar 8, 2017
Member
I think a better approach for this one would be to wrap the entire card inside of an anchor element.
riavalon
Mar 9, 2017
Author
Contributor
We would have to add an <a role="link"> around the contents of each card, though. Isn't it a bit more concise to just add the role-link to the md-card itself?
jelbourn
Mar 9, 2017
Member
In general it's always better to use the appropriate native element instead of a role. An <a> also has the proper associated href and tab index.
| @@ -1,9 +1,9 @@ | |||
| <md-sidenav-container class="docs-component-viewer-sidenav-container"> | |||
| <md-sidenav #sidenav class="docs-component-viewer-sidenav" | |||
| <md-sidenav aria-label="Side navigation" role="navigation" #sidenav class="docs-component-viewer-sidenav" | |||
jelbourn
Mar 8, 2017
Member
I'm wondering if we should avoid having <nav> inside of a role="navigation" and instead wrap the entire sidenav content in one <nav>
riavalon
Mar 9, 2017
Author
Contributor
I don't think that this is necessarily a problem. To my knowledge, a <nav> element or an element with role="navigation" just cannot have a <main> or role="main" as a descendant. Adding the role navigation here to allow screen readers to see the whole side nav, and then dig down into the individual sections of the side nav was suggested based off this issue: #111
| @@ -1,9 +1,9 @@ | |||
| <md-sidenav-container class="docs-component-viewer-sidenav-container"> | |||
| <md-sidenav #sidenav class="docs-component-viewer-sidenav" | |||
| <md-sidenav aria-label="Side navigation" role="navigation" #sidenav class="docs-component-viewer-sidenav" | |||
| @@ -1,22 +1,24 @@ | |||
| <!-- TODO(jelbourn): turn this into nav tabs --> | |||
| <md-tab-group class="docs-component-viewer-tabbed-content" | |||
| <md-tab-group role="tablist" class="docs-component-viewer-tabbed-content" | |||
jelbourn
Mar 8, 2017
Member
The roles and other aria attributes are something that really belong as part of the md-tab-group implementation
| @@ -1,4 +1,4 @@ | |||
| :host { | |||
| :host, .guides-container { | |||
| @@ -29,7 +29,7 @@ const DOCS = [ | |||
| }, | |||
| { | |||
| id: 'nav', | |||
| name: 'Navigation', | |||
| name: 'Navigation Components', | |||
jelbourn
Mar 8, 2017
Member
It's somewhat redundant for this to say "Navigation components" since they're all components. Could it perhaps just be done as an aria label?
riavalon
Mar 9, 2017
Author
Contributor
Ah, I just added "Components" to it since the screen reader otherwise reads it as "Navigation navigation". I'll see if we can change it to an aria label instead.
| @@ -3,6 +3,8 @@ | |||
| <div class="docs-example-viewer-title-spacer">{{exampleData?.title}}</div> | |||
|
|
|||
| <button md-icon-button type="button" (click)="toggleSourceView()" | |||
| role="button" | |||
jelbourn
Mar 8, 2017
Member
role="button" should never be necessary on a <button> element
(here and elsewhere)
| // Focus host element after view loads | ||
| // so screen readers will be alerted | ||
| // the page has changed. | ||
| this._element.nativeElement.focus(); |
jelbourn
Mar 8, 2017
Member
This seems like a very risky change to make; generally having an element grab focus to itself without user input can cause problems. I'll try to look into alternate approaches
riavalon
Mar 9, 2017
•
Author
Contributor
We mostly just need to find a way to signify that the page has changed after a user navigates with a screen reader. At the moment, there is no indication that anything has happened. It was recommended that we focus a heading in the main content area of the page, though I definitely agree that it does feel like there should be a better way to signify this.
naomiblack
Mar 21, 2017
@riavalon have you tried setting a document title? I would expect a screen reader to notice and announce a change in the title. Have a look here: https://angular.io/docs/ts/latest/cookbook/set-document-title.html
Can you see if this is a better solution?
riavalon
Mar 21, 2017
•
Author
Contributor
I actually tried this already, @naomiblack. Even with a title change the screen reader does not announce anything else. Though, updating the document title during navigation seems like a good thing to have anyway. I can add that back in.
naomiblack
Mar 21, 2017
that is definitely weird. I'll see if I can get some help on this one -- yes -- please do add a document title change back in.
| @@ -1,12 +1,12 @@ | |||
| <!-- TODO: figure out if the <nav> should go inside of a <header> element. --> | |||
| <nav class="docs-navbar"> | |||
| <nav aria-label="Main" role="navigation" class="docs-navbar"> | |||
| <a md-button routerLink="components">Components</a> | ||
| <a md-button routerLink="guides">Guides</a> | ||
| <a aria-label="Components" role="link" md-button routerLink="components">Components</a> | ||
| <a aria-label="Guides" role="link" md-button routerLink="guides">Guides</a> |
06046b4
to
786c7c1
|
Issue: User action:
Solutions:
Notes:
|
6a72f43
to
7967c1b
This is to address #111 issues