From a99234d528b12bd080096041ff0612672782cdd3 Mon Sep 17 00:00:00 2001 From: Hannah Issermann Date: Wed, 28 Dec 2022 22:19:34 +0100 Subject: [PATCH] =?UTF-8?q?Use=20aria-labelledby=20to=20associate=20form-t?= =?UTF-8?q?ext=20(helper)=20with=20input=20field=20=E2=80=A6=20(#37587)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Use aria-labelledby to associate form-text (helper) with input field when it contains mandatory info (e.g. data format) * Example in input-group needs aria-describedby (or aria-labelledby) too Co-authored-by: Mark Otto --- site/content/docs/5.3/forms/input-group.md | 4 ++-- site/content/docs/5.3/forms/overview.md | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/site/content/docs/5.3/forms/input-group.md b/site/content/docs/5.3/forms/input-group.md index 01be5cffed..59b478d4c1 100644 --- a/site/content/docs/5.3/forms/input-group.md +++ b/site/content/docs/5.3/forms/input-group.md @@ -25,9 +25,9 @@ Place one add-on or button on either side of an input. You may also place one on
https://example.com/users/ - +
-
Example help text goes outside the input group.
+
Example help text goes outside the input group.
diff --git a/site/content/docs/5.3/forms/overview.md b/site/content/docs/5.3/forms/overview.md index 9e54a08bd9..3ed7081137 100644 --- a/site/content/docs/5.3/forms/overview.md +++ b/site/content/docs/5.3/forms/overview.md @@ -58,14 +58,15 @@ Block-level or inline-level form text can be created using `.form-text`. {{< callout warning >}} ##### Associating form text with form controls -Form 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 form text when the user focuses or enters the control. +Form text should be explicitly associated with the form control it relates to using the `aria-labelledby` (for mandatory information such as data format) or `aria-describedby` (for complementary information) attribute. +This will ensure that assistive technologies—such as screen readers—will announce this form text when the user focuses or enters the control. {{< /callout >}} Form text below inputs can be styled with `.form-text`. If a block-level element will be used, a top margin is added for easy spacing from the inputs above. {{< example >}} - +
Your password must be 8-20 characters long, contain letters and numbers, and must not contain spaces, special characters, or emoji.
@@ -79,7 +80,7 @@ Inline text can use any typical inline HTML element (be it a ``, ``
- +