Skip to content

Commit 7a98a7e

Browse files
committed
Add another example for forms
1 parent e8756f0 commit 7a98a7e

File tree

7 files changed

+82
-11
lines changed

7 files changed

+82
-11
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {CheckboxAccessibilityDemo} from './checkbox/checkbox-a11y';
1212
import {ChipsAccessibilityDemo} from './chips/chips-a11y';
1313
import {
1414
DialogAccessibilityDemo,
15+
DialogAddressFormDialog,
1516
DialogFruitExampleDialog,
1617
DialogNeptuneExampleDialog,
1718
DialogNeptuneIFrameDialog,
@@ -56,6 +57,7 @@ export class AccessibilityRoutingModule {}
5657
ChipsAccessibilityDemo,
5758
DatepickerAccessibilityDemo,
5859
DialogAccessibilityDemo,
60+
DialogAddressFormDialog,
5961
DialogFruitExampleDialog,
6062
DialogNeptuneExampleDialog,
6163
DialogNeptuneIFrameDialog,
@@ -70,6 +72,7 @@ export class AccessibilityRoutingModule {}
7072
],
7173
entryComponents: [
7274
DialogAccessibilityDemo,
75+
DialogAddressFormDialog,
7376
DialogFruitExampleDialog,
7477
DialogNeptuneExampleDialog,
7578
DialogNeptuneIFrameDialog,

src/demo-app/a11y/dialog/dialog-a11y.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,11 @@ <h2>Neptune</h2>
2121
</p>
2222
<button md-button (click)="openNeptuneDialog()">Learn Neptune</button>
2323
</section>
24+
25+
<section>
26+
<h2>Address form</h2>
27+
<p>
28+
Active the button to fill out shipping address information in a dialog.
29+
</p>
30+
<button md-button (click)="openAddressDialog()">Add address</button>
31+
</section>

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

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ export class DialogAccessibilityDemo {
2727
openNeptuneDialog() {
2828
this.dialog.open(DialogNeptuneExampleDialog);
2929
}
30+
31+
openAddressDialog() {
32+
this.dialog.open(DialogAddressFormDialog);
33+
}
3034
}
3135

3236
@Component({
@@ -39,10 +43,7 @@ export class DialogFruitExampleDialog {}
3943
@Component({
4044
moduleId: module.id,
4145
selector: 'dialog-welcome-a11y',
42-
template: `Welcome to Angular Material dialog demo page!
43-
<md-dialog-actions>
44-
<button md-raised-button color="primary" md-dialog-close>Close</button>
45-
</md-dialog-actions>`
46+
templateUrl: 'dialog-welcome-a11y.html'
4647
})
4748
export class DialogWelcomeExampleDialog {}
4849

@@ -69,5 +70,11 @@ export class DialogNeptuneExampleDialog {
6970
],
7071
templateUrl: './dialog-neptune-iframe-a11y.html'
7172
})
72-
export class DialogNeptuneIFrameDialog {
73-
}
73+
export class DialogNeptuneIFrameDialog {}
74+
75+
@Component({
76+
moduleId: module.id,
77+
selector: 'dialog-address-form-a11y',
78+
templateUrl: 'dialog-address-form-a11y.html'
79+
})
80+
export class DialogAddressFormDialog {}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<h2 md-dialog-title>Company</h2>
2+
3+
<md-dialog-content>
4+
<form class="example-form">
5+
<md-form-field class="example-full-width">
6+
<input mdInput placeholder="Company (disabled)" disabled value="Google">
7+
</md-form-field>
8+
9+
<table class="example-full-width" cellspacing="0"><tr>
10+
<td><md-form-field class="example-full-width">
11+
<input mdInput placeholder="First name">
12+
</md-form-field></td>
13+
<td><md-form-field class="example-full-width">
14+
<input mdInput placeholder="Long Last Name That Will Be Truncated">
15+
</md-form-field></td>
16+
</tr></table>
17+
18+
<p>
19+
<md-form-field class="example-full-width">
20+
<textarea mdInput placeholder="Address">1600 Amphitheatre Pkwy</textarea>
21+
</md-form-field>
22+
<md-form-field class="example-full-width">
23+
<textarea mdInput placeholder="Address 2"></textarea>
24+
</md-form-field>
25+
</p>
26+
27+
<table class="example-full-width" cellspacing="0"><tr>
28+
<td><md-form-field class="example-full-width">
29+
<input mdInput placeholder="City">
30+
</md-form-field></td>
31+
<td><md-form-field class="example-full-width">
32+
<input mdInput placeholder="State">
33+
</md-form-field></td>
34+
<td><md-form-field class="example-full-width">
35+
<input mdInput #postalCode maxlength="5" placeholder="Postal Code" value="94043">
36+
<md-hint align="end">{{postalCode.value.length}} / 5</md-hint>
37+
</md-form-field></td>
38+
</tr></table>
39+
</form>
40+
</md-dialog-content>
41+
42+
<md-dialog-actions>
43+
<button md-raised-button color="primary" md-dialog-close>Submit</button>
44+
<button md-raised-button md-dialog-close>Close</button>
45+
</md-dialog-actions>

src/demo-app/a11y/dialog/dialog-neptune-iframe-a11y.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,5 @@ <h2 md-dialog-title>Neptune</h2>
55
</md-dialog-content>
66

77
<md-dialog-actions>
8-
<button
9-
md-raised-button
10-
color="primary"
11-
md-dialog-close>Close</button>
8+
<button md-raised-button color="primary" md-dialog-close>Close</button>
129
</md-dialog-actions>
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1-
Welcome to Angular Material dialog demo page!
1+
<h2>Welcome to Angular Material dialog demo page!</h2>
2+
3+
<p>
4+
The Web is fundamentally designed to work for all people, whatever their hardware, software,
5+
language, culture, location, or physical or mental ability. When the Web meets this goal, it is
6+
accessible to people with a diverse range of hearing, movement, sight, and cognitive ability.
7+
</p>
8+
<p>
9+
The mission of the Web Accessibility Initiative (WAI) is to lead the Web to its full potential to
10+
be accessible, enabling people with disabilities to participate equally on the Web.
11+
</p>
212

313
<button md-button color="primary" md-dialog-close>Close</button>

src/lib/dialog/dialog-config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,6 @@ export class MdDialogConfig {
6969
/** ID of the element that describes the dialog. */
7070
ariaDescribedBy?: string | null = null;
7171

72+
7273
// TODO(jelbourn): add configuration for lifecycle hooks, ARIA labelling.
7374
}

0 commit comments

Comments
 (0)