Skip to content

Commit bf6e99d

Browse files
committed
Make accessibility work without toolbar
1 parent d1383ff commit bf6e99d

22 files changed

+372
-315
lines changed

src/demo-app/a11y/a11y-module.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import {NgModule} from '@angular/core';
2+
import {CommonModule} from '@angular/common';
3+
import {RouterModule} from '@angular/router';
4+
import {ACCESSIBILITY_DEMO_ROUTES} from './routes';
5+
import {DemoMaterialModule} from '../demo-material-module';
6+
import {AccessibilityHome, AccessibilityDemo} from './a11y';
7+
import {ButtonAccessibilityDemo} from './button/button-a11y';
8+
import {CheckboxAccessibilityDemo} from './checkbox/checkbox-a11y';
9+
10+
@NgModule({
11+
imports: [
12+
RouterModule.forChild(ACCESSIBILITY_DEMO_ROUTES)
13+
],
14+
exports: [
15+
RouterModule
16+
]
17+
})
18+
export class AccessibilityRoutingModule {}
19+
20+
@NgModule({
21+
imports: [
22+
CommonModule,
23+
AccessibilityRoutingModule,
24+
DemoMaterialModule,
25+
],
26+
declarations: [
27+
AccessibilityDemo,
28+
AccessibilityHome,
29+
ButtonAccessibilityDemo,
30+
CheckboxAccessibilityDemo,
31+
]
32+
})
33+
export class AccessibilityDemoModule {}

src/demo-app/a11y/a11y.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<h1>Accessibility Demo</h1>
2+
3+
<nav>
4+
<ul>
5+
<li *ngFor="let navItem of navItems">
6+
<a [routerLink]="[navItem.route]">
7+
{{navItem.name}}
8+
</a>
9+
</li>
10+
</ul>
11+
</nav>
12+
13+
<router-outlet></router-outlet>

src/demo-app/a11y/a11y.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
body {
2+
font-family: Roboto, 'Helvetica Neue', sans-serif;
3+
4+
// Helps fonts on OSX looks more consistent with other systems
5+
// Isn't currently in button styles due to performance concerns
6+
* {
7+
-webkit-font-smoothing: antialiased;
8+
-moz-osx-font-smoothing: grayscale;
9+
}
10+
11+
h1 {
12+
font-size: 20px;
13+
}
14+
15+
ul, li {
16+
list-style: none;
17+
}
18+
}

src/demo-app/a11y/a11y.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import {Component, ViewEncapsulation} from '@angular/core';
2+
3+
@Component({
4+
moduleId: module.id,
5+
selector: 'accessibility-home',
6+
template: `<p>Welcome to the accessibility demos for Angular Material!</p>
7+
<p>Open the sidenav to select a demo.</p>`,
8+
})
9+
export class AccessibilityHome {}
10+
11+
@Component({
12+
moduleId: module.id,
13+
selector: 'accessibility-demo',
14+
templateUrl: 'a11y.html',
15+
styleUrls: ['a11y.css'],
16+
encapsulation: ViewEncapsulation.None,
17+
})
18+
export class AccessibilityDemo {
19+
navItems = [
20+
{name: 'Home', route: '.'},
21+
{name: 'Button', route: 'button'},
22+
{name: 'Checkbox', route: 'checkbox'},
23+
];
24+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<div class="demo-button">
2+
<section>
3+
<h2></h2>
4+
<button md-button>Check</button>
5+
<button md-raised-button>raised</button>
6+
<button md-fab aria-label="Activate floating action style button">
7+
<md-icon class="md-24">check</md-icon>
8+
</button>
9+
<button md-mini-fab aria-label="Activate mini floating action style button">
10+
<md-icon class="md-24">check</md-icon>
11+
</button>
12+
<button md-icon-button aria-label="Activate icon style button">
13+
<md-icon class="md-24">check</md-icon>
14+
</button>
15+
</section>
16+
17+
<section>
18+
<a href="http://www.google.com" md-button color="primary">Google search</a>
19+
<a href="http://www.google.com" md-raised-button>Google search</a>
20+
<a href="http://www.google.com" md-fab aria-label="Activate floating action style link">
21+
<md-icon class="md-24">check</md-icon>
22+
</a>
23+
<a href="http://www.google.com" md-mini-fab aria-label="Activate mini floating action style link">
24+
<md-icon class="md-24">check</md-icon>
25+
</a>
26+
<a md-icon-button aria-label="Activate icon style link">
27+
<md-icon class="md-24">check</md-icon>
28+
</a>
29+
</section>
30+
</div>

src/demo-app/accessibility/button/button-accessibility.ts renamed to src/demo-app/a11y/button/button-a11y.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import {Component} from '@angular/core';
33

44
@Component({
55
moduleId: module.id,
6-
selector: 'button-accessibility',
7-
templateUrl: 'button-accessibility.html',
8-
styleUrls: ['button-accessibility.css'],
6+
selector: 'button-a11y',
7+
templateUrl: 'button-a11y.html',
8+
styleUrls: ['button-a11y.css'],
99
})
1010
export class ButtonAccessibilityDemo {
1111
// TODO(tinayuangao): Add use cases
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Checkbox Placeholder

src/demo-app/a11y/checkbox/checkbox-a11y.scss

Whitespace-only changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import {Component} from '@angular/core';
2+
3+
4+
@Component({
5+
moduleId: module.id,
6+
selector: 'checkbox-a11y',
7+
templateUrl: 'checkbox-a11y.html',
8+
styleUrls: ['checkbox-a11y.css'],
9+
})
10+
export class CheckboxAccessibilityDemo {
11+
// TODO(tinayuangao): Add use cases
12+
}

src/demo-app/a11y/routes.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import {Routes} from '@angular/router';
2+
import {ButtonAccessibilityDemo} from './button/button-a11y';
3+
import {CheckboxAccessibilityDemo} from './checkbox/checkbox-a11y';
4+
import {AccessibilityHome} from './a11y';
5+
6+
export const ACCESSIBILITY_DEMO_ROUTES: Routes = [
7+
{path: '', component: AccessibilityHome},
8+
{path: 'button', component: ButtonAccessibilityDemo},
9+
{path: 'checkbox', component: CheckboxAccessibilityDemo},
10+
];

src/demo-app/accessibility/accessibility-module.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/demo-app/accessibility/accessibility.html

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/demo-app/accessibility/accessibility.ts

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/demo-app/accessibility/button/button-accessibility.html

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/demo-app/accessibility/routes.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)