|
1 | 1 | <article role="article">
|
2 |
| - <header class="row well"> |
3 |
| - <h2>Accessible form control labels</h2> |
| 2 | + <header class="row well"> |
| 3 | + <h2>Accessible form control labels</h2> |
| 4 | + </header> |
| 5 | + |
| 6 | + <section class="row well"> |
| 7 | + <header> |
| 8 | + <h3>Implicit labeling</h3> |
| 9 | + <hr> |
| 10 | + </header> |
| 11 | + |
| 12 | + <div class="form-group"> |
| 13 | + <label>Type something: |
| 14 | + <input class="form-control" |
| 15 | + [(ngModel)]="inputModel"> |
| 16 | + </label> |
| 17 | + </div> |
| 18 | + |
| 19 | + <div class="form-group"> |
| 20 | + <label>Type some text: |
| 21 | + <input class="form-control" |
| 22 | + [(ngModel)]="textModel"> |
| 23 | + </label> |
| 24 | + </div> |
| 25 | + |
| 26 | + <fieldset class="form-group row"> |
| 27 | + <legend class="col-xs-12"> |
| 28 | + What do you like most about Angular 2? |
| 29 | + </legend> |
| 30 | + <div *ngFor="#checkbox of checkBoxes" class="checkbox col-xs-12"> |
| 31 | + <label> |
| 32 | + <input #checkboxInput type="checkbox" |
| 33 | + [checked]="isChecked(checkbox.value)" |
| 34 | + (click)="toggleCheckbox(checkboxInput.value)" |
| 35 | + [value]="checkbox.value" [name]="checkboxName"> |
| 36 | + {{checkbox.name}} |
| 37 | + </label> |
| 38 | + </div> |
| 39 | + </fieldset> |
| 40 | + |
| 41 | + <fieldset class="form-group row"> |
| 42 | + <legend class="col-xs-12"> |
| 43 | + Choose your favourite Angular 2 language |
| 44 | + </legend> |
| 45 | + <div *ngFor="#radiobutton of radioButtons" |
| 46 | + class="radio col-xs-12"> |
| 47 | + <label> |
| 48 | + <input type="radio" |
| 49 | + [checked]="radioModel == radiobutton.value" |
| 50 | + [value]="radiobutton.value" |
| 51 | + [name]="'language'" |
| 52 | + (click)="radioModel = radiobutton.value"> |
| 53 | + {{radiobutton.name}} |
| 54 | + </label> |
| 55 | + </div> |
| 56 | + </fieldset> |
| 57 | + |
| 58 | + <div class="form-group"> |
| 59 | + <label>Why are interested in a11y? |
| 60 | + <select class="form-control" |
| 61 | + [(ngModel)]="selectModel"> |
| 62 | + <option *ngFor="#option of selectOptions" |
| 63 | + [value]="option.value"> |
| 64 | + {{option.name}} |
| 65 | + </option> |
| 66 | + </select> |
| 67 | + </label> |
| 68 | + </div> |
| 69 | + |
| 70 | + <button class="btn btn-primary" (click)="submitMe()">Submit</button> |
| 71 | + |
| 72 | + </section> |
| 73 | + |
| 74 | + <section class="row well"> |
| 75 | + <header> |
| 76 | + <h3>Explicit labeling</h3> |
| 77 | + <hr> |
| 78 | + </header> |
| 79 | + |
| 80 | + <div class="form-group"> |
| 81 | + <label for="inputexplicit"> |
| 82 | + Label for input: |
| 83 | + </label> |
| 84 | + <input id="inputexplicit" |
| 85 | + [(ngModel)]="inputExplicitModel" |
| 86 | + class="form-control"> |
| 87 | + </div> |
| 88 | + |
| 89 | + <button class="btn btn-primary" (click)="submitMe()">Submit</button> |
| 90 | + |
| 91 | + </section> |
| 92 | + |
| 93 | + <!--<section class="row well">--> |
| 94 | + <!--<header>--> |
| 95 | + <!--<h3>Implicit labeling</h3>--> |
| 96 | + <!--<hr>--> |
| 97 | + <!--</header>--> |
| 98 | + |
| 99 | + <!--<!– #docregion cb-a11y-form-controls-input-usage –>--> |
| 100 | + <!--<a11y-input>Type something:</a11y-input>--> |
| 101 | + <!--<!–#enddocregion–>--> |
| 102 | + |
| 103 | + <!--<!– #docregion cb-a11y-form-controls-textarea-usage –>--> |
| 104 | + <!--<a11y-textarea>Type some text:</a11y-textarea>--> |
| 105 | + <!--<!–#enddocregion–>--> |
| 106 | + |
| 107 | + <!--<!– #docregion cb-a11y-form-controls-checkboxes-usage –>--> |
| 108 | + <!--<a11y-checkboxes [checkboxModel]="checkBoxes" [checkboxName]="'likes'">--> |
| 109 | + <!--What do you like most about Angular 2?--> |
| 110 | + <!--</a11y-checkboxes>--> |
| 111 | + <!--<!–#enddocregion–>--> |
| 112 | + |
| 113 | + <!--<!– #docregion cb-a11y-form-controls-radiobuttons-usage –>--> |
| 114 | + <!--<a11y-radiobuttons [radiobuttonModel]="radioButtons" [radiobuttonName]="'language'">--> |
| 115 | + <!--Choose your favourite Angular 2 language:--> |
| 116 | + <!--</a11y-radiobuttons>--> |
| 117 | + <!--<!–#enddocregion–>--> |
| 118 | + |
| 119 | + <!--<!– #docregion cb-a11y-form-controls-select-usage –>--> |
| 120 | + <!--<a11y-select [optionsModel]="selectOptions">Why are you interested in a11y?</a11y-select>--> |
| 121 | + <!--<!–#enddocregion–>--> |
| 122 | + |
| 123 | + <!--</section>--> |
| 124 | + <!--<section class="row well">--> |
| 125 | + <!--<header>--> |
| 126 | + <!--<h3>Explicit labeling</h3>--> |
| 127 | + <!--<hr>--> |
| 128 | + <!--</header>--> |
| 129 | + |
| 130 | + <!--<!– #docregion cb-a11y-form-controls-input-explicit-usage –>--> |
| 131 | + <!--<a11y-input-explicit> Label for input:</a11y-input-explicit>--> |
| 132 | + <!--<!–#enddocregion–>--> |
| 133 | + |
| 134 | + <!--</section>--> |
| 135 | + <section class="row well"> |
| 136 | + <header> |
| 137 | + <h3>Hiding labels</h3> |
| 138 | + <hr> |
4 | 139 | </header>
|
5 |
| - <section class="row well"> |
6 |
| - <header> |
7 |
| - <h3>Implicit labeling</h3> |
8 |
| - <hr> |
9 |
| - </header> |
10 |
| - |
11 |
| - <!-- #docregion cb-a11y-form-controls-input-usage --> |
12 |
| - <a11y-input>Type something:</a11y-input> |
13 |
| - <!--#enddocregion--> |
14 |
| - |
15 |
| - <!-- #docregion cb-a11y-form-controls-textarea-usage --> |
16 |
| - <a11y-textarea>Type some text:</a11y-textarea> |
17 |
| - <!--#enddocregion--> |
18 |
| - |
19 |
| - <!-- #docregion cb-a11y-form-controls-checkboxes-usage --> |
20 |
| - <a11y-checkboxes [checkboxModel]="checkBoxes" [checkboxName]="'likes'"> |
21 |
| - What do you like most about Angular 2? |
22 |
| - </a11y-checkboxes> |
23 |
| - <!--#enddocregion--> |
24 |
| - |
25 |
| - <!-- #docregion cb-a11y-form-controls-radiobuttons-usage --> |
26 |
| - <a11y-radiobuttons [radiobuttonModel]="radioButtons" [radiobuttonName]="'language'"> |
27 |
| - Choose your favourite Angular 2 language: |
28 |
| - </a11y-radiobuttons> |
29 |
| - <!--#enddocregion--> |
30 |
| - |
31 |
| - <!-- #docregion cb-a11y-form-controls-select-usage --> |
32 |
| - <a11y-select [optionsModel]="selectOptions">Why are you interested in a11y?</a11y-select> |
33 |
| - <!--#enddocregion--> |
34 |
| - |
35 |
| - </section> |
36 |
| - <section class="row well"> |
37 |
| - <header> |
38 |
| - <h3>Explicit labeling</h3> |
39 |
| - <hr> |
40 |
| - </header> |
41 |
| - |
42 |
| - <!-- #docregion cb-a11y-form-controls-input-explicit-usage --> |
43 |
| - <a11y-input-explicit> Label for input:</a11y-input-explicit> |
44 |
| - <!--#enddocregion--> |
45 |
| - |
46 |
| - </section> |
47 |
| - <section class="row well"> |
48 |
| - <header> |
49 |
| - <h3>Hiding labels</h3> |
50 |
| - <hr> |
51 |
| - </header> |
52 |
| - |
53 |
| - <!-- #docregion cb-a11y-form-controls-hidden-labels-usage --> |
54 |
| - <a11y-hidden-labels [label1]="'Search:'" |
55 |
| - [label2]="'Filter:'"> |
56 |
| - </a11y-hidden-labels> |
57 |
| - <!--#enddocregion--> |
58 |
| - |
59 |
| - </section> |
60 |
| - <section class="row well"> |
61 |
| - <header> |
62 |
| - <h3>Labeling custom controls</h3> |
63 |
| - <hr> |
64 |
| - </header> |
65 |
| - </section> |
66 |
| - <a href="" [routerLink]="['Index']">Back to index...</a> |
| 140 | + |
| 141 | + <!-- #docregion cb-a11y-form-controls-hidden-labels-usage --> |
| 142 | + <a11y-hidden-labels [label1]="'Search:'" |
| 143 | + [label2]="'Filter:'"> |
| 144 | + </a11y-hidden-labels> |
| 145 | + <!--#enddocregion--> |
| 146 | + |
| 147 | + </section> |
| 148 | + <section class="row well"> |
| 149 | + <header> |
| 150 | + <h3>Labeling custom controls</h3> |
| 151 | + <hr> |
| 152 | + </header> |
| 153 | + |
| 154 | + <!-- #docregion cb-a11y-form-controls-custom-control-usage --> |
| 155 | + <a11y-custom-control>Write in this labelled div:</a11y-custom-control> |
| 156 | + <!--#enddocregion--> |
| 157 | + |
| 158 | + </section> |
| 159 | + <a href="" [routerLink]="['Index']">Back to index...</a> |
67 | 160 | </article>
|
68 | 161 |
|
69 | 162 |
|
0 commit comments