-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
demo(tabs): Add accessibility demo page for tabs (#6610)
* Add accessibility demo page for tabs * fix lint; * .
- Loading branch information
1 parent
4f4c48c
commit f2cae6e
Showing
7 changed files
with
155 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import {Routes} from '@angular/router'; | ||
|
||
import {SunnyTabContent, RainyTabContent, FoggyTabContent} from './tabs-a11y'; | ||
|
||
export const TABS_DEMO_ROUTES: Routes = [ | ||
{path: '', redirectTo: 'sunny-tab', pathMatch: 'full'}, | ||
{path: 'sunny-tab', component: SunnyTabContent}, | ||
{path: 'rainy-tab', component: RainyTabContent}, | ||
{path: 'foggy-tab', component: FoggyTabContent}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<section> | ||
<h2>Weather</h2> | ||
<p>Switch tabs to navigate</p> | ||
|
||
<nav md-tab-nav-bar aria-label="weather navigation links"> | ||
<a md-tab-link | ||
*ngFor="let tabLink of tabLinks; let i = index" | ||
[routerLink]="tabLink.link" | ||
routerLinkActive #rla="routerLinkActive" | ||
[active]="rla.isActive"> | ||
{{tabLink.label}} | ||
</a> | ||
</nav> | ||
<router-outlet></router-outlet> | ||
</section> | ||
|
||
<section> | ||
<h2>Dog breeds</h2> | ||
<p>Dynamic height tabs</p> | ||
|
||
<md-tab-group class="demo-tab-group" dynamicHeight> | ||
<md-tab *ngFor="let tab of tabs" [disabled]="tab.disabled"> | ||
<ng-template md-tab-label>{{tab.label}}</ng-template> | ||
<div class="tab-content"> | ||
{{tab.content}} | ||
<br> | ||
<br> | ||
<div *ngIf="tab.extraContent"> | ||
The Labrador Retriever, also Labrador, is a type of retriever-gun dog. The Labrador is | ||
one of the most popular breeds of dog in the United Kingdom and the United States. | ||
<br> | ||
<br> | ||
A favourite disability assistance breed in many countries, Labradors are frequently | ||
trained to aid the blind, those who have autism, to act as a therapy dog and perform | ||
screening and detection work for law enforcement and other official agencies. They are | ||
prized as sporting and hunting dogs. | ||
<br> | ||
<br> | ||
A few kennels breeding their ancestors, the St. John's water dog, were in England. | ||
At the same time, a combination of the sheep protection policy in Newfoundland and rabies | ||
quarantine in the United Kingdom, led to the gradual demise of the St. John's water dog | ||
in Canada. | ||
<br> | ||
<br> | ||
In the 1830s, the 10th Earl of Home and his nephews the 5th Duke of Buccleuch and Lord | ||
John Scott, had imported progenitors of the breed from Newfoundland to Europe for | ||
use as gundogs. Another early advocate of these Newfoundland dogs, or Labrador Retrievers | ||
as they later became known, was the 2nd Earl of Malmesbury who bred them for their | ||
expertise in waterfowling. | ||
|
||
During the 1880s, the 3rd Earl of Malmesbury, the 6th Duke of Buccleuch and the 12th Earl | ||
of Home collaborated to develop and establish the modern Labrador breed. The dogs | ||
Buccleuch Avon and Buccleuch Ned, given by Malmesbury to Buccleuch, were mated with | ||
bitches carrying blood from those originally imported by the 5th Duke and the 10th Earl | ||
of Home. The offspring are considered to be the ancestors of modern Labradors. | ||
<br> | ||
<br> | ||
</div> | ||
</div> | ||
</md-tab> | ||
</md-tab-group> | ||
</section> | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import {Component} from '@angular/core'; | ||
|
||
@Component({ | ||
moduleId: module.id, | ||
selector: 'tabs-a11y', | ||
templateUrl: 'tabs-a11y.html', | ||
styleUrls: ['tabs-a11y.css'], | ||
}) | ||
export class TabsAccessibilityDemo { | ||
// Nav bar demo | ||
tabLinks = [ | ||
{label: 'Sun', link: 'sunny-tab'}, | ||
{label: 'Rain', link: 'rainy-tab'}, | ||
{label: 'Fog', link: 'foggy-tab'}, | ||
]; | ||
|
||
// Standard tabs demo | ||
tabs = [ | ||
{ | ||
label: 'German Shepherd', | ||
content: `The German Shepherd is a breed of medium to large-sized working dog that originated | ||
in Germany. The breed's officially recognized name is German Shepherd Dog in the | ||
English language. The breed is also known as the Alsatian in Britain and Ireland.` | ||
}, { | ||
label: 'Labrador Retriever', | ||
extraContent: true, | ||
content: `The Labrador Retriever, also Labrador, is a type of retriever-gun dog. The Labrador | ||
is one of the most popular breeds of dog in the United Kingdom and the United States.` | ||
}, { | ||
label: 'Rottweiler', | ||
disabled: true, | ||
content: `The Rottweiler is a breed of domestic dog, regarded as medium-to-large or large. | ||
The dogs were known in German as Rottweiler Metzgerhund, meaning Rottweil butchers' dogs, | ||
because their main use was to ...` | ||
}, { | ||
label: 'Beagle', | ||
content: `The Beagle is a breed of small hound, similar in appearance to the much larger | ||
foxhound. The beagle is a scent hound, developed primarily for hunting hare.` | ||
}, | ||
]; | ||
} | ||
|
||
|
||
@Component({ | ||
moduleId: module.id, | ||
selector: 'sunny-routed-content', | ||
template: 'Having a lot of light from the sun.', | ||
}) | ||
export class SunnyTabContent {} | ||
|
||
|
||
@Component({ | ||
moduleId: module.id, | ||
selector: 'rainy-routed-content', | ||
template: 'A rainy period of time is one when it rains a lot', | ||
}) | ||
export class RainyTabContent {} | ||
|
||
|
||
@Component({ | ||
moduleId: module.id, | ||
selector: 'foggy-routed-content', | ||
template: 'If the weather is foggy, there is fog', | ||
}) | ||
export class FoggyTabContent {} |