aboutsummaryrefslogtreecommitdiff
path: root/docs/components/button-group.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/components/button-group.md')
-rw-r--r--docs/components/button-group.md12
1 files changed, 10 insertions, 2 deletions
diff --git a/docs/components/button-group.md b/docs/components/button-group.md
index 59a18e262..d2d5140ed 100644
--- a/docs/components/button-group.md
+++ b/docs/components/button-group.md
@@ -12,6 +12,14 @@ Group a series of buttons together on a single line with the button group. Add o
* Will be replaced with the ToC, excluding the "Contents" header
{:toc}
+{% callout warning %}
+## Ensure correct `role` and provide a label
+
+In order for assistive technologies (such as screen readers) to convey that a series of buttons is grouped, an appropriate `role` attribute needs to be provided. For button groups, this would be `role="group"`, while toolbars should have a `role="toolbar"`.
+
+In addition, groups and toolbars should be given an explicit label, as most assistive technologies will otherwise not announce them, despite the presence of the correct role attribute. In the examples provided here, we use `aria-label`, but alternatives such as `aria-labelledby` can also be used.
+{% endcallout %}
+
## Basic example
Wrap a series of buttons with `.btn` in `.btn-group`.
@@ -59,7 +67,7 @@ Feel free to mix input groups with button groups in your toolbars. Similar to th
</div>
<div class="input-group">
<span class="input-group-addon" id="btnGroupAddon">@</span>
- <input type="text" class="form-control" placeholder="Input group example" aria-describedby="btnGroupAddon">
+ <input type="text" class="form-control" placeholder="Input group example" aria-label="Input group example" aria-describedby="btnGroupAddon">
</div>
</div>
@@ -72,7 +80,7 @@ Feel free to mix input groups with button groups in your toolbars. Similar to th
</div>
<div class="input-group">
<span class="input-group-addon" id="btnGroupAddon2">@</span>
- <input type="text" class="form-control" placeholder="Input group example" aria-describedby="btnGroupAddon2">
+ <input type="text" class="form-control" placeholder="Input group example" aria-label="Input group example" aria-describedby="btnGroupAddon2">
</div>
</div>
{% endexample %}