mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
demo(tooltip): add accessibility demo for tooltip (#7058)
Adds an accessibility demo page for the tooltip. Fixes #6499.
This commit is contained in:
committed by
mmalerba
parent
b666616a45
commit
5e02aef3a7
@@ -39,6 +39,7 @@ import {
|
||||
RainyTabContent,
|
||||
FoggyTabContent,
|
||||
} from './tabs/tabs-a11y';
|
||||
import {TooltipAccessibilityDemo} from './tooltip/tooltip-a11y';
|
||||
|
||||
|
||||
@NgModule({
|
||||
@@ -91,6 +92,7 @@ export class AccessibilityRoutingModule {}
|
||||
SunnyTabContent,
|
||||
RainyTabContent,
|
||||
FoggyTabContent,
|
||||
TooltipAccessibilityDemo,
|
||||
],
|
||||
entryComponents: [
|
||||
DialogAccessibilityDemo,
|
||||
|
||||
@@ -40,6 +40,7 @@ export class AccessibilityDemo {
|
||||
{name: 'Select', route: 'select'},
|
||||
{name: 'Tabs', route: 'tabs'},
|
||||
{name: 'Toolbar', route: 'toolbar'},
|
||||
{name: 'Tooltip', route: 'tooltip'},
|
||||
];
|
||||
|
||||
skipNavigation() {
|
||||
|
||||
@@ -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},
|
||||
@@ -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},
|
||||
];
|
||||
|
||||
@@ -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>
|
||||
@@ -0,0 +1,8 @@
|
||||
import {Component} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
moduleId: module.id,
|
||||
selector: 'tooltip-a11y',
|
||||
templateUrl: 'tooltip-a11y.html',
|
||||
})
|
||||
export class TooltipAccessibilityDemo {}
|
||||
Reference in New Issue
Block a user