add focus on error

This commit is contained in:
zandercymatics 2025-02-27 10:58:44 -07:00
parent 1d8742237d
commit 09289769b8
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
2 changed files with 5 additions and 8 deletions

View file

@ -372,11 +372,6 @@ export function initFormsetsForms() {
});
});
}
if (newForm) {
// announce("new form added")
newForm.focus();
}
}
}

View file

@ -1,16 +1,18 @@
{% if form.errors %}
<div id="form-errors">
{% for error in form.non_field_errors %}
<div class="usa-alert usa-alert--error usa-alert--slim margin-bottom-2" role="alert">
<div class="usa-alert usa-alert--error usa-alert--slim margin-bottom-2" role="alert" tabindex="0">
<div class="usa-alert__body">
{{ error|escape }}
<span class="usa-sr-only">Error:</span>
{{ error|escape }}
</div>
</div>
{% endfor %}
{% for field in form %}
{% for error in field.errors %}
<div class="usa-alert usa-alert--error usa-alert--slim margin-bottom-2">
<div class="usa-alert usa-alert--error usa-alert--slim margin-bottom-2" tabindex="0">
<div class="usa-alert__body">
<span class="usa-sr-only">Error:</span>
{{ error|escape }}
</div>
</div>