Skip to content

Commit 185dd0d

Browse files
author
Zac Echola
committed
Move help block docs up page, add .help-block to validation example
1 parent 66543ed commit 185dd0d

File tree

2 files changed

+29
-25
lines changed

2 files changed

+29
-25
lines changed

docs/_includes/css/forms.html

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,30 @@ <h2 id="forms-control-readonly">Readonly state</h2>
609609
{% endhighlight %}
610610

611611

612+
<h2 id="forms-help-text">Help text</h2>
613+
<p>Block level help text for form controls.</p>
614+
<div class="bs-callout bs-callout-info" id="callout-help-text-accessibility">
615+
<h4>Associating help text with form controls</h4>
616+
<p>Help text should be explicitly associated with the form control it relates to using the <code>aria-describedby</code> attribute. This will ensure that assistive technologies – such as screen readers – will announce this help text when the user focuses or enters the control.</p>
617+
</div>
618+
<div class="bs-example" data-example-id="simple-help-text">
619+
<form>
620+
<div class="form-group">
621+
<label for="inputHelpBlock">Input with help text</label>
622+
<input type="text" id="inputHelpBlock" class="form-control" aria-describedby="helpBlock">
623+
</div>
624+
<span id="helpBlock" class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>
625+
</form>
626+
</div><!-- /.bs-example -->
627+
{% highlight html %}
628+
<label class="sr-only" for="inputHelpBlock">Input with help text</label>
629+
<input type="text" id="inputHelpBlock" class="form-control" aria-describedby="helpBlock">
630+
...
631+
<span id="helpBlock" class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>
632+
{% endhighlight %}
633+
</div>
634+
635+
612636
<h2 id="forms-control-validation">Validation states</h2>
613637
<p>Bootstrap includes validation styles for error, warning, and success states on form controls. To use, add <code>.has-warning</code>, <code>.has-error</code>, or <code>.has-success</code> to the parent element. Any <code>.control-label</code>, <code>.form-control</code>, and <code>.help-block</code> within that element will receive the validation styles.</p>
614638

@@ -622,7 +646,8 @@ <h4>Conveying validation state to assistive technologies and colorblind users</h
622646
<form>
623647
<div class="form-group has-success">
624648
<label class="control-label" for="inputSuccess1">Input with success</label>
625-
<input type="text" class="form-control" id="inputSuccess1">
649+
<input type="text" class="form-control" id="inputSuccess1" aria-describedby="helpBlock2">
650+
<span id="helpBlock2" class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>
626651
</div>
627652
<div class="form-group has-warning">
628653
<label class="control-label" for="inputWarning1">Input with warning</label>
@@ -661,7 +686,8 @@ <h4>Conveying validation state to assistive technologies and colorblind users</h
661686
{% highlight html %}
662687
<div class="form-group has-success">
663688
<label class="control-label" for="inputSuccess1">Input with success</label>
664-
<input type="text" class="form-control" id="inputSuccess1">
689+
<input type="text" class="form-control" id="inputSuccess1" aria-describedby="helpBlock2">
690+
<span id="helpBlock2" class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>
665691
</div>
666692
<div class="form-group has-warning">
667693
<label class="control-label" for="inputWarning1">Input with warning</label>
@@ -1001,25 +1027,3 @@ <h3>Column sizing</h3>
10011027
</div>
10021028
{% endhighlight %}
10031029

1004-
<h2 id="forms-help-text">Help text</h2>
1005-
<p>Block level help text for form controls.</p>
1006-
<div class="bs-callout bs-callout-info" id="callout-help-text-accessibility">
1007-
<h4>Associating help text with form controls</h4>
1008-
<p>Help text should be explicitly associated with the form control it relates to using the <code>aria-describedby</code> attribute. This will ensure that assistive technologies – such as screen readers – will announce this help text when the user focuses or enters the control.</p>
1009-
</div>
1010-
<div class="bs-example" data-example-id="simple-help-text">
1011-
<form>
1012-
<div class="form-group">
1013-
<label for="inputHelpBlock">Input with help text</label>
1014-
<input type="text" id="inputHelpBlock" class="form-control" aria-describedby="helpBlock">
1015-
</div>
1016-
<span id="helpBlock" class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>
1017-
</form>
1018-
</div><!-- /.bs-example -->
1019-
{% highlight html %}
1020-
<label class="sr-only" for="inputHelpBlock">Input with help text</label>
1021-
<input type="text" id="inputHelpBlock" class="form-control" aria-describedby="helpBlock">
1022-
...
1023-
<span id="helpBlock" class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>
1024-
{% endhighlight %}
1025-
</div>

docs/_includes/nav/css.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@
7373
<li><a href="#forms-control-focus">Focus state</a></li>
7474
<li><a href="#forms-control-disabled">Disabled state</a></li>
7575
<li><a href="#forms-control-readonly">Readonly state</a></li>
76+
<li><a href="#forms-help-text">Help text</a></li>
7677
<li><a href="#forms-control-validation">Validation states</a></li>
7778
<li><a href="#forms-control-sizes">Control sizing</a></li>
78-
<li><a href="#forms-help-text">Help text</a></li>
7979
</ul>
8080
</li>
8181
<li>

0 commit comments

Comments
 (0)