Skip to content

demo(tooltip): add accessibility demo for tooltip #7058

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

Merged
merged 1 commit into from
Sep 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/demo-app/a11y/a11y-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
RainyTabContent,
FoggyTabContent,
} from './tabs/tabs-a11y';
import {TooltipAccessibilityDemo} from './tooltip/tooltip-a11y';


@NgModule({
Expand Down Expand Up @@ -91,6 +92,7 @@ export class AccessibilityRoutingModule {}
SunnyTabContent,
RainyTabContent,
FoggyTabContent,
TooltipAccessibilityDemo,
],
entryComponents: [
DialogAccessibilityDemo,
Expand Down
1 change: 1 addition & 0 deletions src/demo-app/a11y/a11y.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export class AccessibilityDemo {
{name: 'Select', route: 'select'},
{name: 'Tabs', route: 'tabs'},
{name: 'Toolbar', route: 'toolbar'},
{name: 'Tooltip', route: 'tooltip'},
];

skipNavigation() {
Expand Down
2 changes: 2 additions & 0 deletions src/demo-app/a11y/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {SnackBarAccessibilityDemo} from './snack-bar/snack-bar-a11y';
import {SelectAccessibilityDemo} from './select/select-a11y';
import {TabsAccessibilityDemo} from './tabs/tabs-a11y';
import {TABS_DEMO_ROUTES} from './tabs/routes';
import {TooltipAccessibilityDemo} from './tooltip/tooltip-a11y';

export const ACCESSIBILITY_DEMO_ROUTES: Routes = [
{path: '', component: AccessibilityHome},
Expand All @@ -46,4 +47,5 @@ export const ACCESSIBILITY_DEMO_ROUTES: Routes = [
{path: 'select', component: SelectAccessibilityDemo},
{path: 'tabs', component: TabsAccessibilityDemo, children: TABS_DEMO_ROUTES},
{path: 'toolbar', component: ToolbarAccessibilityDemo},
{path: 'tooltip', component: TooltipAccessibilityDemo},
];
45 changes: 45 additions & 0 deletions src/demo-app/a11y/tooltip/tooltip-a11y.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<section>
<h2>Mouse over or tab to trigger a tooltip</h2>
<p>Mouse over or focus the button to show and hide the tooltip</p>
<button md-raised-button mdTooltip="This is an example of a tooltip">What is this?</button>
</section>


<section>
<h2>Click to trigger a tooltip</h2>
<button md-raised-button (click)="tooltip.toggle(); $event.stopPropagation()">Toggle the tooltip</button>
<button md-raised-button mdTooltip="This is a tooltip that shows on click" #tooltip="mdTooltip">I have a tooltip</button>
</section>


<section>
<h2>Different tooltip positions</h2>

<button
md-raised-button
mdTooltip="This tooltip appears below the trigger"
mdTooltipPosition="below">Below</button>

<button
md-raised-button
mdTooltip="This tooltip appears above the trigger"
mdTooltipPosition="above">Above</button>

<button
md-raised-button
mdTooltip="This tooltip appears to the left of the trigger"
mdTooltipPosition="left">Left</button>

<button
md-raised-button
mdTooltip="This tooltip appears to the right of the trigger"
mdTooltipPosition="right">Right</button>
</section>

<section>
<h2>Delayed tooltip</h2>
<button
md-raised-button
mdTooltip="This tooltip will show up after a delay"
[mdTooltipShowDelay]="2000">What is this?</button>
</section>
8 changes: 8 additions & 0 deletions src/demo-app/a11y/tooltip/tooltip-a11y.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {Component} from '@angular/core';

@Component({
moduleId: module.id,
selector: 'tooltip-a11y',
templateUrl: 'tooltip-a11y.html',
})
export class TooltipAccessibilityDemo {}