Skip to content

Commit 30d7f69

Browse files
committed
docs(fieldlabel): fix some example docs for form
- Fix incorrect field group usage in example markup for Form. Previously had a "for" attribute for an ID that didn't exist, and was using a label. But this was more of a fieldset usage and needed to use the aria attributes (reference Field group). - Improves some titles and descriptions to be more clear about alignment
1 parent 081729a commit 30d7f69

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

components/fieldlabel/metadata/form.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Form
22
description: Form provides structure and spacing for your form fields.
33
examples:
44
- id: form-labels-left
5-
name: Form (labels left)
6-
description: Apply `.spectrum-FieldLabel--left` to each FieldLabel to get left labels.
5+
name: Standard - left-aligned text
6+
description: A two column layout with left-aligned label text. Apply `.spectrum-FieldLabel--left` to each Field label.
77
markup: |
88
<form class="spectrum-Form">
99
<div class="spectrum-Form-item">
@@ -34,8 +34,8 @@ examples:
3434
</div>
3535
</div>
3636
37-
<div class="spectrum-Form-item">
38-
<label class="spectrum-FieldLabel spectrum-FieldLabel--sizeM spectrum-Form-itemLabel spectrum-FieldLabel--left" for="spectrum-textinput-instance">Interests</label>
37+
<div class="spectrum-Form-item" role="group" aria-labelledby="checkboxgroup-label-1">
38+
<div class="spectrum-FieldLabel spectrum-FieldLabel--sizeM spectrum-Form-itemLabel spectrum-FieldLabel--left" id="checkboxgroup-label-1">Interests</div>
3939
<div class="spectrum-Form-itemField">
4040
<div class="spectrum-FieldGroup spectrum-FieldGroup--vertical">
4141
<label class="spectrum-Checkbox spectrum-Checkbox--sizeM spectrum-FieldGroup-item">
@@ -84,8 +84,8 @@ examples:
8484
</div>
8585
</form>
8686
- id: form-labels-right
87-
name: Form (labels right)
88-
description: Apply `.spectrum-FieldLabel--right` to each FieldLabel to get right labels.
87+
name: Right-aligned text
88+
description: A two column layout with right-aligned label text. Apply `.spectrum-FieldLabel--right` to each Field label.
8989
markup: |
9090
<form class="spectrum-Form">
9191
<div class="spectrum-Form-item">
@@ -116,8 +116,8 @@ examples:
116116
</div>
117117
</div>
118118
119-
<div class="spectrum-Form-item">
120-
<label class="spectrum-FieldLabel spectrum-FieldLabel--sizeM spectrum-Form-itemLabel spectrum-FieldLabel--right" for="spectrum-textinput-instance">Interests</label>
119+
<div class="spectrum-Form-item" role="group" aria-labelledby="checkboxgroup-label-2">
120+
<div class="spectrum-FieldLabel spectrum-FieldLabel--sizeM spectrum-Form-itemLabel spectrum-FieldLabel--right" id="checkboxgroup-label-2">Interests</div>
121121
<div class="spectrum-Form-itemField">
122122
<div class="spectrum-FieldGroup spectrum-FieldGroup--vertical">
123123
<label class="spectrum-Checkbox spectrum-Checkbox--sizeM spectrum-FieldGroup-item">
@@ -166,8 +166,8 @@ examples:
166166
</div>
167167
</form>
168168
- id: form-labels-above
169-
name: Form (labels above)
170-
description: "For labels above, the layout changes completely, so you must apply `.spectrum-Form--labelsAbove` to the Form itself. You do not need to apply a specific class to the FieldLabel."
169+
name: Labels above
170+
description: "A stacked layout with the labels above the form fields. Apply the variant class `.spectrum-Form--labelsAbove` to the Form itself. You do not need to apply a specific class to the Field label."
171171
markup: |
172172
<form class="spectrum-Form spectrum-Form--labelsAbove">
173173
<div class="spectrum-Form-item">
@@ -199,9 +199,9 @@ examples:
199199
</div>
200200
201201
<div class="spectrum-Form-item">
202-
<label class="spectrum-FieldLabel spectrum-FieldLabel--sizeM spectrum-Form-itemLabel" for="spectrum-textinput-instance">Interests</label>
202+
<div class="spectrum-FieldLabel spectrum-FieldLabel--sizeM spectrum-Form-itemLabel" role="group" aria-labelledby="checkboxgroup-label-3">Interests</div>
203203
<div class="spectrum-Form-itemField">
204-
<div class="spectrum-FieldGroup spectrum-FieldGroup--vertical">
204+
<div class="spectrum-FieldGroup spectrum-FieldGroup--vertical" id="checkboxgroup-label-3">
205205
<label class="spectrum-Checkbox spectrum-Checkbox--sizeM spectrum-FieldGroup-item">
206206
<input type="checkbox" class="spectrum-Checkbox-input" id="checkbox-0">
207207
<span class="spectrum-Checkbox-box">

0 commit comments

Comments
 (0)