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

chore(accessibility): Add aria attributes to aid screen reader flow #117

Open
wants to merge 1 commit into
base: master
from

Conversation

@riavalon
Copy link
Contributor

@riavalon riavalon commented Mar 2, 2017

This is to address #111 issues

@googlebot googlebot added the cla: yes label Mar 2, 2017
@riavalon riavalon force-pushed the riavalon:feat-a11y-additions branch from 613ccb9 to 597ac5f Mar 7, 2017
@@ -1,5 +1,6 @@
<div class="docs-component-category-list">
<md-card
role="link"

This comment has been minimized.

@jelbourn

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.

This comment has been minimized.

@riavalon

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?

This comment has been minimized.

@jelbourn

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"

This comment has been minimized.

@jelbourn

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>

This comment has been minimized.

@riavalon

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"

This comment has been minimized.

@jelbourn

jelbourn Mar 8, 2017
Member

A more informative aria-label might be "Component navigation"

@@ -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"

This comment has been minimized.

@jelbourn

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 {

This comment has been minimized.

@jelbourn

jelbourn Mar 8, 2017
Member

Should be prefixed as .docs-guide-container

@@ -29,7 +29,7 @@ const DOCS = [
},
{
id: 'nav',
name: 'Navigation',
name: 'Navigation Components',

This comment has been minimized.

@jelbourn

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?

This comment has been minimized.

@riavalon

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"

This comment has been minimized.

@jelbourn

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();

This comment has been minimized.

@jelbourn

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

This comment has been minimized.

@riavalon

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.

This comment has been minimized.

@naomiblack

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?

This comment has been minimized.

@riavalon

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.

This comment has been minimized.

@naomiblack

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">

This comment has been minimized.

@jelbourn

jelbourn Mar 8, 2017
Member

I'm not sure role="navigation" should be necessary for a <nav> element

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

This comment has been minimized.

@jelbourn

jelbourn Mar 8, 2017
Member

role="link" shouldn't be necessary for an <a> element

@riavalon riavalon force-pushed the riavalon:feat-a11y-additions branch 2 times, most recently from 06046b4 to 786c7c1 Mar 9, 2017
@riavalon riavalon force-pushed the riavalon:feat-a11y-additions branch from 786c7c1 to 7b82ca6 Mar 21, 2017
@DaveBest99
Copy link

@DaveBest99 DaveBest99 commented Apr 4, 2017

Issue:
Page content should not update without being initiated by a user action, or some notification is given to the user (2.4 Alert and Message Dialogs) to inform of the page behaviour.
On the Angular Material demo page (https://material.angular.io/components) the page content is updated when the user presses the Enter key on one of the Navigation Link elements. However, the screen reader does not notify the user that page content has been updated.

User action:

  • Press the Tab key to move focus to a Navigation Link element "Autocomplete".
  • Press Enter key to activate the Link element.
  • Page content updates, but screen reader focus does not move and no screen reader output announces the page change.

Solutions:

  1. Do not move the cursor focus, but announce the page update by adding an aria-alert to the h1 tag "Component - Autocomplete" (2.3 ARIA Alert role).
  2. After the page content updates, upon the Enter key press, move the cursor focus to the h1 tag "Component - Autocomplete" (2.14 ARIA Link - Enter: Executes the link and moves focus to the link target).
  3. Update the page Title by appending the h1 tag "Component - Autocomplete" to the Title (I.E. "Component - Autocomplete - Angular Material").

Notes:

  • WCAG2.4.2 Page Titled: Web pages have titles that describe topic or purpose. (Level A).
    The intent of this Success Criterion is to help users find content and orient themselves within it by ensuring that each Web page has a descriptive title. Titles identify the current location without requiring users to read or interpret page content.
    http://www.w3.org/TR/UNDERSTANDING-WCAG20/complete.html

  • ARIA2.5 Breadcrumb: A breadcrumb trail consists of a list of links to the parent pages of the current page in hierarchical order. It helps users find their place within a website or web application. Breadcrumbs are often placed horizontally before a page's main content.
    http://w3c.github.io/aria-practices/

@riavalon riavalon force-pushed the riavalon:feat-a11y-additions branch 2 times, most recently from 6a72f43 to 7967c1b Apr 10, 2017
@riavalon riavalon force-pushed the riavalon:feat-a11y-additions branch from 7967c1b to 27837ab May 31, 2017
@riavalon riavalon force-pushed the riavalon:feat-a11y-additions branch from 27837ab to a3b3acf Jun 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.