From a68ad6d58dae93207b5aabac84124b17b1a8abe3 Mon Sep 17 00:00:00 2001 From: Ward Bell Date: Mon, 15 May 2017 14:52:39 -0700 Subject: [PATCH] feat(aio): sidenav headers should be focusable buttons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sidenav headers had been anchors w/o hrefs. These can’t take focus which makes you can’t navigate through them with keyboard. For a11y purposes, this PR turns them into buttons. --- aio/e2e/app.e2e-spec.ts | 2 +- aio/e2e/app.po.ts | 14 ++++++++------ .../layout/nav-item/nav-item.component.html | 4 ++-- aio/src/styles/1-layouts/_sidenav.scss | 19 ++++++++++++++++++- aio/src/styles/_constants.scss | 1 + 5 files changed, 30 insertions(+), 10 deletions(-) diff --git a/aio/e2e/app.e2e-spec.ts b/aio/e2e/app.e2e-spec.ts index 1a941da2f4..c9417e76e9 100644 --- a/aio/e2e/app.e2e-spec.ts +++ b/aio/e2e/app.e2e-spec.ts @@ -5,8 +5,8 @@ describe('site App', function() { let page: SitePage; beforeEach(() => { + SitePage.setWindowWidth(1050); // Make the window wide enough to show the SideNav side-by-side. page = new SitePage(); - page.setWindowWidth(1050); // Make the window wide enough to show the SideNav side-by-side. page.navigateTo(); }); diff --git a/aio/e2e/app.po.ts b/aio/e2e/app.po.ts index 6d28739a5a..2677ac7dd3 100644 --- a/aio/e2e/app.po.ts +++ b/aio/e2e/app.po.ts @@ -3,6 +3,7 @@ import { browser, element, by, promise, ElementFinder } from 'protractor'; const githubRegex = /https:\/\/github.com\/angular\/angular\//; export class SitePage { + links = element.all(by.css('md-toolbar a')); docsMenuLink = element(by.cssContainingText('aio-top-menu a', 'Docs')); docViewer = element(by.css('aio-doc-viewer')); @@ -12,8 +13,14 @@ export class SitePage { .filter((a: ElementFinder) => a.getAttribute('href').then(href => githubRegex.test(href))) .first(); gaReady: promise.Promise; + + static setWindowWidth(newWidth: number) { + const win = browser.driver.manage().window(); + return win.getSize().then(oldSize => win.setSize(newWidth, oldSize.height)); + } + getNavItem(pattern: RegExp) { - return element.all(by.css('aio-nav-item a')) + return element.all(by.css('aio-nav-item .vertical-menu-item')) .filter(element => element.getText().then(text => pattern.test(text))) .first(); } @@ -35,11 +42,6 @@ export class SitePage { return browser.executeScript('return arguments[0].innerHTML;', element); } - setWindowWidth(newWidth: number) { - const win = browser.driver.manage().window(); - return win.getSize().then(oldSize => win.setSize(newWidth, oldSize.height)); - } - /** * Replace the ambient Google Analytics tracker with homebrew spy * don't send commands to GA during e2e testing! diff --git a/aio/src/app/layout/nav-item/nav-item.component.html b/aio/src/app/layout/nav-item/nav-item.component.html index 5f53f58dd5..d1be279aff 100644 --- a/aio/src/app/layout/nav-item/nav-item.component.html +++ b/aio/src/app/layout/nav-item/nav-item.component.html @@ -12,11 +12,11 @@ - {{node.title}} - +