Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
aria describedby errors
diff --git a/web/themes/custom/lsac/components/_patterns/01-atoms/form-elements/form-element/form-element.twig b/web/themes/custom/lsac/components/_patterns/01-atoms/form-elements/form-element/form-element.twig
index 9e6cc85d6..18523d252 100644
--- a/web/themes/custom/lsac/components/_patterns/01-atoms/form-elements/form-element/form-element.twig
+++ b/web/themes/custom/lsac/components/_patterns/01-atoms/form-elements/form-element/form-element.twig
@@ -79,6 +79,7 @@
{{ description.content }}
</div>
{% endif %}
+ {{ kint(children) }}
{{ children }}
{% if suffix is not empty %}
<span class="field-suffix">{{ suffix }}</span>
@@ -87,7 +88,7 @@
{{ label }}
{% endif %}
{% if errors %}
- <div class="form-item--error-message">
+ <div class="form-item--error-message" id="{{name|clean_class}}--error">
<strong>{{ errors }}</strong>
</div>
{% endif %}
diff --git a/web/themes/custom/lsac/templates/01-atoms/input.html.twig b/web/themes/custom/lsac/templates/01-atoms/input.html.twig
index a065161e9..39000fe4a 100644
--- a/web/themes/custom/lsac/templates/01-atoms/input.html.twig
+++ b/web/themes/custom/lsac/templates/01-atoms/input.html.twig
@@ -1 +1,8 @@
+{% if element["#errors"] %}
+ {% set attributes = attributes.setAttribute('aria-describedby', element["#name"]|clean_class ~ '--error' ) %}
+{% endif %}
+
{% include "@atoms/form-elements/input/input.twig" %}
+
+
+{{ kint() }}
(END)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.