diff options
| author | Mark Otto <[email protected]> | 2014-11-11 19:25:16 -0800 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2014-11-11 19:25:16 -0800 |
| commit | 1e268ddfc30def5f4b2b0f2ace34b7de549ea830 (patch) | |
| tree | 7cc63bc43a6c3b603cef4f004a2285e5c034a710 /docs/_includes/css | |
| parent | 4f6aeaa6347725436296131c4d2b059243390a04 (diff) | |
| parent | 001d5e00c58bbb8e4d34c085c5b27b214a475bd5 (diff) | |
| download | bootstrap-1e268ddfc30def5f4b2b0f2ace34b7de549ea830.tar.xz bootstrap-1e268ddfc30def5f4b2b0f2ace34b7de549ea830.zip | |
Merge branch 'master' into labels-readme
Diffstat (limited to 'docs/_includes/css')
| -rw-r--r-- | docs/_includes/css/buttons.html | 14 | ||||
| -rw-r--r-- | docs/_includes/css/forms.html | 116 | ||||
| -rw-r--r-- | docs/_includes/css/grid.html | 2 | ||||
| -rw-r--r-- | docs/_includes/css/helpers.html | 8 | ||||
| -rw-r--r-- | docs/_includes/css/tables.html | 5 |
5 files changed, 98 insertions, 47 deletions
diff --git a/docs/_includes/css/buttons.html b/docs/_includes/css/buttons.html index ee03c1d65..1b3f46416 100644 --- a/docs/_includes/css/buttons.html +++ b/docs/_includes/css/buttons.html @@ -35,6 +35,11 @@ <button type="button" class="btn btn-link">Link</button> {% endhighlight %} + <div class="bs-callout bs-callout-warning"> + <h4>Conveying meaning to assistive technologies</h4> + <p>Using color to add meaning to a button only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (the visible text of the button), or is included through alternative means, such as additional text hidden with the <code>sr-only</code> class.</p> + </div> + <h2 id="buttons-sizes">Sizes</h2> <p>Fancy larger or smaller buttons? Add <code>.btn-lg</code>, <code>.btn-sm</code>, or <code>.btn-xs</code> for additional sizes.</p> <div class="bs-example"> @@ -88,7 +93,7 @@ <h2 id="buttons-active">Active state</h2> - <p>Buttons will appear pressed (with a darker background, darker border, and inset shadow) when active. For <code><button></code> elements, this is done via <code>:active</code>. For <code><a></code> elements, it's done with <code>.active</code>. However, you may use <code>.active</code> on <code><button></code>s should you need to replicate the active state programmatically.</p> + <p>Buttons will appear pressed (with a darker background, darker border, and inset shadow) when active. For <code><button></code> elements, this is done via <code>:active</code>. For <code><a></code> elements, it's done with <code>.active</code>. However, you may use <code>.active</code> on <code><button></code>s (and include the <code>aria-pressed="true"</code> attribute) should you need to replicate the active state programmatically.</p> <h3>Button element</h3> <p>No need to add <code>:active</code> as it's a pseudo-class, but if you need to force the same appearance, go ahead and add <code>.active</code>.</p> @@ -147,7 +152,7 @@ </p> <div class="bs-callout bs-callout-warning"> <h4>Link functionality caveat</h4> - <p>This class uses <code>pointer-events: none</code> to try to disable the link functionality of <code><a></code>s, but that CSS property is not yet standardized and isn't fully supported in Opera 18 and below, or in Internet Explorer 11. So to be safe, use custom JavaScript to disable such links.</p> + <p>This class uses <code>pointer-events: none</code> to try to disable the link functionality of <code><a></code>s, but that CSS property is not yet standardized and isn't fully supported in Opera 18 and below, or in Internet Explorer 11. In addition, even in browsers that do support <code>pointer-events: none</code>, keyboard navigation remains unaffected, meaning that sighted keyboard users and users of assistive technologies will still be able to activate these links. So to be safe, use custom JavaScript to disable such links.</p> </div> <div class="bs-callout bs-callout-warning"> <h4>Context-specific usage</h4> @@ -171,6 +176,11 @@ {% endhighlight %} <div class="bs-callout bs-callout-warning"> + <h4>Links acting as buttons</h4> + <p>If the <code><a></code> elements are used to act as buttons – triggering in-page functionality, rather than navigating to another document or section within the current page – they should also be given an appropriate <code>role="button"</code>.</p> + </div> + + <div class="bs-callout bs-callout-warning"> <h4>Cross-browser rendering</h4> <p>As a best practice, <strong>we highly recommend using the <code><button></code> element whenever possible</strong> to ensure matching cross-browser rendering.</p> <p>Among other things, there's <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=697451">a bug in Firefox <30</a> that prevents us from setting the <code>line-height</code> of <code><input></code>-based buttons, causing them to not exactly match the height of other buttons on Firefox.</p> diff --git a/docs/_includes/css/forms.html b/docs/_includes/css/forms.html index 33e0befb1..96b9b6ce0 100644 --- a/docs/_includes/css/forms.html +++ b/docs/_includes/css/forms.html @@ -63,7 +63,7 @@ </div> <div class="bs-callout bs-callout-warning"> <h4>Always add labels</h4> - <p>Screen readers will have trouble with your forms if you don't include a label for every input. For these inline forms, you can hide the labels using the <code>.sr-only</code> class.</p> + <p>Screen readers will have trouble with your forms if you don't include a label for every input. For these inline forms, you can hide the labels using the <code>.sr-only</code> class. There are further alternative methods of providing a label for assistive technologies, such as the <code>aria-label</code>, <code>aria-labelledby</code> or <code>title</code> attribute. If none of these is present, screen readers may resort to using the <code>placeholder</code> attribute, if present, but note that use of <code>placeholder</code> as a replacement for other labelling methods is not advised.</p> </div> <div class="bs-example"> <form class="form-inline" role="form"> @@ -92,13 +92,10 @@ {% highlight html %} <form class="form-inline" role="form"> <div class="form-group"> - <label class="sr-only" for="exampleInputEmail2">Email address</label> - <input type="email" class="form-control" id="exampleInputEmail2" placeholder="Enter email"> - </div> - <div class="form-group"> <div class="input-group"> + <label class="sr-only" for="exampleInputEmail2">Email address</label> <div class="input-group-addon">@</div> - <input class="form-control" type="email" placeholder="Enter email"> + <input type="email" class="form-control" id="exampleInputEmail2" placeholder="Enter email"> </div> </div> <div class="form-group"> @@ -205,7 +202,7 @@ <p>Form control which supports multiple lines of text. Change <code>rows</code> attribute as necessary.</p> <div class="bs-example"> <form role="form"> - <textarea class="form-control" rows="3"></textarea> + <textarea class="form-control" rows="3" placeholder="Textarea"></textarea> </form> </div><!-- /.bs-example --> {% highlight html %} @@ -334,18 +331,18 @@ </label> {% endhighlight %} - <h4>Checkboxes and radios without labels</h4> - <p>Should you have no text within the <code><label></code>, the input is positioned as you'd expect. <strong>Currently only works on non-inline checkboxes and radios.</strong></p> + <h4>Checkboxes and radios without label text</h4> + <p>Should you have no text within the <code><label></code>, the input is positioned as you'd expect. <strong>Currently only works on non-inline checkboxes and radios.</strong> Remember to still provide some form of label for assistive technologies (for instance, using <code>aria-label</code>).</p> <div class="bs-example"> <form role="form"> <div class="checkbox"> <label> - <input type="checkbox" id="blankCheckbox" value="option1"> + <input type="checkbox" id="blankCheckbox" value="option1" aria-label="Checkbox without label text"> </label> </div> <div class="radio"> <label> - <input type="radio" name="blankRadio" id="blankRadio1" value="option1"> + <input type="radio" name="blankRadio" id="blankRadio1" value="option1" aria-label="Radio button without label text"> </label> </div> </form> @@ -353,12 +350,12 @@ {% highlight html %} <div class="checkbox"> <label> - <input type="checkbox" id="blankCheckbox" value="option1"> + <input type="checkbox" id="blankCheckbox" value="option1" aria-label="..."> </label> </div> <div class="radio"> <label> - <input type="radio" name="blankRadio" id="blankRadio1" value="option1"> + <input type="radio" name="blankRadio" id="blankRadio1" value="option1" aria-label="..."> </label> </div> {% endhighlight %} @@ -464,7 +461,7 @@ </form> {% endhighlight %} - <h2 id="forms-control-focus">Input focus</h2> + <h2 id="forms-control-focus">Focus state</h2> <p>We remove the default <code>outline</code> styles on some form controls and apply a <code>box-shadow</code> in its place for <code>:focus</code>.</p> <div class="bs-example"> <form role="form"> @@ -477,7 +474,7 @@ </div> - <h2 id="forms-control-disabled">Disabled inputs</h2> + <h2 id="forms-control-disabled">Disabled state</h2> <p>Add the <code>disabled</code> boolean attribute on an input to prevent user input and trigger a slightly different look.</p> <div class="bs-example"> <form role="form"> @@ -547,7 +544,7 @@ {% endhighlight %} - <h2 id="forms-control-readonly">Readonly inputs</h2> + <h2 id="forms-control-readonly">Readonly state</h2> <p>Add the <code>readonly</code> boolean attribute on an input to prevent user input and style the input as disabled.</p> <div class="bs-example"> <form role="form"> @@ -562,6 +559,12 @@ <h2 id="forms-control-validation">Validation states</h2> <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> + <div class="bs-callout bs-callout-warning"> + <h4>Conveying validation state to assistive technologies</h4> + <p>Using these validation styles to denote the state of a form control only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers.</p> + <p>Ensure that an alternative indication of state is also provided. For instance, you can include a hint about state in the form control's <code><label></code> text itself (as is the case in the following code example), or associate an additional element with textual information about the validation state with the form control using <code>aria-describedby</code> (see the example in the following section). In the case of an error, you could also use the <code>aria-invalid="true"</code> attribute on the form control.</p> + </div> + <div class="bs-example"> <form role="form"> <div class="form-group has-success"> @@ -648,40 +651,51 @@ <h4>Icons, labels, and input groups</h4> <p>Manual positioning of feedback icons is required for inputs without a label and for <a href="../components#input-groups">input groups</a> with an add-on on the right. You are strongly encouraged to provide labels for all inputs for accessibility reasons. If you wish to prevent labels from being displayed, hide them with the <code>sr-only</code> class. If you must do without labels, adjust the <code>top</code> value of the feedback icon. For input groups, adjust the <code>right</code> value to an appropriate pixel value depending on the width of your addon.</p> </div> + <div class="bs-callout bs-callout-warning"> + <h4>Conveying the icon's meaning to assistive technologies</h4> + <p>To ensure that assistive technologies – such as screen readers – correctly convey the meaning of an icon, additional hidden text should be included with the <code>sr-only</code> class and explicitly associated with the form control it relates to using <code>aria-describedby</code>. Alternatively, ensure that the meaning (for instance, the fact that there is a warning for a particular text entry field) is conveyed in some other form, such as changing the text of the actual <code><label></code> associated with the form control.</p> + <p>Although the following examples already mention the validation state of their respective form controls in the <code><label></code> text itself, the above technique (using <code>sr-only</code> text and <code>aria-describedby</code>) has been included for illustrative purposes.</p> + </div> <div class="bs-example"> <form role="form"> <div class="form-group has-success has-feedback"> <label class="control-label" for="inputSuccess2">Input with success</label> - <input type="text" class="form-control" id="inputSuccess2"> - <span class="glyphicon glyphicon-ok form-control-feedback"></span> + <input type="text" class="form-control" id="inputSuccess2" aria-describedby="inputSuccess2Status"> + <span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span> + <span id="inputSuccess2Status" class="sr-only">(success)</span> </div> <div class="form-group has-warning has-feedback"> <label class="control-label" for="inputWarning2">Input with warning</label> - <input type="text" class="form-control" id="inputWarning2"> - <span class="glyphicon glyphicon-warning-sign form-control-feedback"></span> + <input type="text" class="form-control" id="inputWarning2" aria-describedby="inputWarning2Status"> + <span class="glyphicon glyphicon-warning-sign form-control-feedback" aria-hidden="true"></span> + <span id="inputWarning2Status" class="sr-only">(warning)</span> </div> <div class="form-group has-error has-feedback"> <label class="control-label" for="inputError2">Input with error</label> - <input type="text" class="form-control" id="inputError2"> - <span class="glyphicon glyphicon-remove form-control-feedback"></span> + <input type="text" class="form-control" id="inputError2" aria-describedby="inputError2Status"> + <span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"></span> + <span id="inputError2Status" class="sr-only">(error)</span> </div> </form> </div> {% highlight html %} <div class="form-group has-success has-feedback"> <label class="control-label" for="inputSuccess2">Input with success</label> - <input type="text" class="form-control" id="inputSuccess2"> - <span class="glyphicon glyphicon-ok form-control-feedback"></span> + <input type="text" class="form-control" id="inputSuccess2" aria-describedby="inputSuccess2Status"> + <span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span> + <span id="inputSuccess2Status" class="sr-only">(success)</span> </div> <div class="form-group has-warning has-feedback"> <label class="control-label" for="inputWarning2">Input with warning</label> - <input type="text" class="form-control" id="inputWarning2"> - <span class="glyphicon glyphicon-warning-sign form-control-feedback"></span> + <input type="text" class="form-control" id="inputWarning2" aria-describedby="inputWarning2Status"> + <span class="glyphicon glyphicon-warning-sign form-control-feedback" aria-hidden="true"></span> + <span id="inputWarning2Status" class="sr-only">(warning)</span> </div> <div class="form-group has-error has-feedback"> <label class="control-label" for="inputError2">Input with error</label> - <input type="text" class="form-control" id="inputError2"> - <span class="glyphicon glyphicon-remove form-control-feedback"></span> + <input type="text" class="form-control" id="inputError2" aria-describedby="inputError2Status"> + <span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"></span> + <span id="inputError2Status" class="sr-only">(error)</span> </div> {% endhighlight %} @@ -691,8 +705,9 @@ <div class="form-group has-success has-feedback"> <label class="control-label col-sm-3" for="inputSuccess3">Input with success</label> <div class="col-sm-9"> - <input type="text" class="form-control" id="inputSuccess3"> - <span class="glyphicon glyphicon-ok form-control-feedback"></span> + <input type="text" class="form-control" id="inputSuccess3" aria-describedby="inputSuccess3Status"> + <span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span> + <span id="inputSuccess3Status" class="sr-only">(success)</span> </div> </div> </form> @@ -702,8 +717,9 @@ <div class="form-group has-success has-feedback"> <label class="control-label col-sm-3" for="inputSuccess3">Input with success</label> <div class="col-sm-9"> - <input type="text" class="form-control" id="inputSuccess3"> - <span class="glyphicon glyphicon-ok form-control-feedback"></span> + <input type="text" class="form-control" id="inputSuccess3" aria-describedby="inputSuccess3Status"> + <span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span> + <span id="inputSuccess3Status" class="sr-only">(success)</span> </div> </div> </form> @@ -713,8 +729,9 @@ <form class="form-inline" role="form"> <div class="form-group has-success has-feedback"> <label class="control-label" for="inputSuccess4">Input with success</label> - <input type="text" class="form-control" id="inputSuccess4"> - <span class="glyphicon glyphicon-ok form-control-feedback"></span> + <input type="text" class="form-control" id="inputSuccess4" aria-describedby="inputSuccess4Status"> + <span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span> + <span id="inputSuccess4Status" class="sr-only">(success)</span> </div> </form> </div> @@ -722,8 +739,9 @@ <form class="form-inline" role="form"> <div class="form-group has-success has-feedback"> <label class="control-label" for="inputSuccess4">Input with success</label> - <input type="text" class="form-control" id="inputSuccess4"> - <span class="glyphicon glyphicon-ok form-control-feedback"></span> + <input type="text" class="form-control" id="inputSuccess4" aria-describedby="inputSuccess4Status"> + <span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span> + <span id="inputSuccess4Status" class="sr-only">(success)</span> </div> </form> {% endhighlight %} @@ -733,15 +751,17 @@ <div class="bs-example"> <div class="form-group has-success has-feedback"> <label class="control-label sr-only" for="inputSuccess5">Hidden label</label> - <input type="text" class="form-control" id="inputSuccess5"> - <span class="glyphicon glyphicon-ok form-control-feedback"></span> + <input type="text" class="form-control" id="inputSuccess5" aria-describedby="inputSuccess5Status"> + <span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span> + <span id="inputSuccess5Status" class="sr-only">(success)</span> </div> </div> {% highlight html %} <div class="form-group has-success has-feedback"> <label class="control-label sr-only" for="inputSuccess5">Hidden label</label> - <input type="text" class="form-control" id="inputSuccess5"> - <span class="glyphicon glyphicon-ok form-control-feedback"></span> + <input type="text" class="form-control" id="inputSuccess5" aria-describedby="inputSuccess5Status"> + <span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span> + <span id="inputSuccess5Status" class="sr-only">(success)</span> </div> {% endhighlight %} @@ -849,13 +869,23 @@ <h2 id="forms-help-text">Help text</h2> <p>Block level help text for form controls.</p> + <div class="bs-callout bs-callout-info"> + <h4>Associating help text with form controls</h4> + <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> + </div> <div class="bs-example"> <form role="form"> - <input type="text" class="form-control"> - <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span> + <div class="form-group"> + <label for="inputHelpBlock">Input with help text</label> + <input type="text" id="inputHelpBlock" class="form-control" aria-describedby="helpBlock"> + </div> + <span id="helpBlock" class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span> </form> </div><!-- /.bs-example --> {% highlight html %} -<span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span> +<label class="sr-only" for="inputHelpBlock">Input with help text</label> +<input type="text" id="inputHelpBlock" class="form-control" aria-describedby="helpBlock"> +... +<span id="helpBlock" class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span> {% endhighlight %} </div> diff --git a/docs/_includes/css/grid.html b/docs/_includes/css/grid.html index 429ef90f9..cea5b17ee 100644 --- a/docs/_includes/css/grid.html +++ b/docs/_includes/css/grid.html @@ -226,7 +226,7 @@ </div> {% endhighlight %} - <h3 id="grid-example-mixed-complete">Example: Mobile, tablet, desktops</h3> + <h3 id="grid-example-mixed-complete">Example: Mobile, tablet, desktop</h3> <p>Build on the previous example by creating even more dynamic and powerful layouts with tablet <code>.col-sm-*</code> classes.</p> <div class="bs-docs-grid"> <div class="row show-grid"> diff --git a/docs/_includes/css/helpers.html b/docs/_includes/css/helpers.html index 9b7223740..a661ded22 100644 --- a/docs/_includes/css/helpers.html +++ b/docs/_includes/css/helpers.html @@ -23,6 +23,10 @@ <h4>Dealing with specificity</h4> <p>Sometimes emphasis classes cannot be applied due to the specificity of another selector. In most cases, a sufficient workaround is to wrap your text in a <code><span></code> with the class.</p> </div> + <div class="bs-callout bs-callout-warning"> + <h4>Conveying meaning to assistive technologies</h4> + <p>Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (the contextual colors are only used to reinforce meaning that is already present in the text/markup), or is included through alternative means, such as additional text hidden with the <code>.sr-only</code> class.</p> + </div> <h3 id="helper-classes-backgrounds">Contextual backgrounds</h3> <p>Similar to the contextual text color classes, easily set the background of an element to any contextual class. Anchor components will darken on hover, just like the text classes.</p> @@ -44,6 +48,10 @@ <h4>Dealing with specificity</h4> <p>Sometimes contextual background classes cannot be applied due to the specificity of another selector. In some cases, a sufficient workaround is to wrap your element's content in a <code><div></code> with the class.</p> </div> + <div class="bs-callout bs-callout-warning"> + <h4>Conveying meaning to assistive technologies</h4> + <p>As with <a href="#helper-classes-colors">contextual colors</a>, ensure that any meaning conveyed through color is also conveyed in a format that is not purely presentational.</p> + </div> <h3 id="helper-classes-close">Close icon</h3> <p>Use the generic close icon for dismissing content like modals and alerts.</p> diff --git a/docs/_includes/css/tables.html b/docs/_includes/css/tables.html index 011a4dbba..d09c34068 100644 --- a/docs/_includes/css/tables.html +++ b/docs/_includes/css/tables.html @@ -346,7 +346,10 @@ <td class="info">...</td> </tr> {% endhighlight %} - + <div class="bs-callout bs-callout-warning"> + <h4>Conveying meaning to assistive technologies</h4> + <p>Using color to add meaning to a table row or individual cell only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (the visible text in the relevant table row/cell), or is included through alternative means, such as additional text hidden with the <code>sr-only</code> class.</p> + </div> <h2 id="tables-responsive">Responsive tables</h2> <p>Create responsive tables by wrapping any <code>.table</code> in <code>.table-responsive</code> to make them scroll horizontally on small devices (under 768px). When viewing on anything larger than 768px wide, you will not see any difference in these tables.</p> |
