mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-06-05 16:42:29 +03:00
Use callout without custom Jekyll plugin.
This commit is contained in:
@@ -610,20 +610,22 @@ Custom form controls and selects are also supported.
|
||||
</form>
|
||||
{% endexample %}
|
||||
|
||||
{% callout warning %}
|
||||
{% capture callout %}
|
||||
##### Alternatives to hidden labels
|
||||
Assistive technologies such as 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 `.sr-only` class. There are further alternative methods of providing a label for assistive technologies, such as the `aria-label`, `aria-labelledby` or `title` attribute. If none of these are present, assistive technologies may resort to using the `placeholder` attribute, if present, but note that use of `placeholder` as a replacement for other labelling methods is not advised.
|
||||
{% endcallout %}
|
||||
{% endcapture %}
|
||||
{% include callout.html content=callout type="warning" %}
|
||||
|
||||
## Help text
|
||||
|
||||
Block-level help text in forms can be created using `.form-text` (previously known as `.help-block` in v3). Inline help text can be flexibly implemented using any inline HTML element and utility classes like `.text-muted`.
|
||||
|
||||
{% callout warning %}
|
||||
{% capture callout %}
|
||||
##### Associating help text with form controls
|
||||
|
||||
Help text should be explicitly associated with the form control it relates to using the `aria-describedby` attribute. This will ensure that assistive technologies—such as screen readers—will announce this help text when the user focuses or enters the control.
|
||||
{% endcallout %}
|
||||
{% endcapture %}
|
||||
{% include callout.html content=callout type="warning" %}
|
||||
|
||||
Help text below inputs can be styled with `.form-text`. This class includes `display: block` and adds some top margin for easy spacing from the inputs above.
|
||||
|
||||
@@ -683,25 +685,28 @@ Add the `disabled` attribute to a `<fieldset>` to disable all the controls withi
|
||||
</form>
|
||||
{% endexample %}
|
||||
|
||||
{% callout warning %}
|
||||
{% capture callout %}
|
||||
##### Caveat with anchors
|
||||
|
||||
By default, browsers will treat all native form controls (`<input>`, `<select>` and `<button>` elements) inside a `<fieldset disabled>` as disabled, preventing both keyboard and mouse interactions on them. However, if your form also includes `<a ... class="btn btn-*">` elements, these will only be given a style of `pointer-events: none`. As noted in the section about [disabled state for buttons]({{ site.baseurl }}/docs/{{ site.docs_version }}/components/buttons/#disabled-state) (and specifically in the sub-section for anchor elements), this CSS property is not yet standardized and isn't fully supported in Internet Explorer 10, and won't prevent keyboard users from being able to focus or activate these links. So to be safe, use custom JavaScript to disable such links.
|
||||
{% endcallout %}
|
||||
{% endcapture %}
|
||||
{% include callout.html content=callout type="warning" %}
|
||||
|
||||
{% callout danger %}
|
||||
{% capture callout %}
|
||||
#### Cross-browser compatibility
|
||||
|
||||
While Bootstrap will apply these styles in all browsers, Internet Explorer 11 and below don't fully support the `disabled` attribute on a `<fieldset>`. Use custom JavaScript to disable the fieldset in these browsers.
|
||||
{% endcallout %}
|
||||
{% endcapture %}
|
||||
{% include callout.html content=callout type="danger" %}
|
||||
|
||||
## Validation
|
||||
|
||||
Provide valuable, actionable feedback to your users with HTML5 form validation–[available in all our supported browsers](https://caniuse.com/#feat=form-validation). Choose from the browser default validation feedback, or implement custom messages with our built-in classes and starter JavaScript.
|
||||
|
||||
{% callout warning %}
|
||||
{% capture callout %}
|
||||
We currently recommend using custom validation styles, as native browser default validation messages are not consistently exposed to assistive technologies in all browsers (most notably, Chrome on desktop and mobile).
|
||||
{% endcallout %}
|
||||
{% endcapture %}
|
||||
{% include callout.html content=callout type="warning" %}
|
||||
|
||||
### How it works
|
||||
|
||||
|
||||
Reference in New Issue
Block a user