-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2677 from alphagov/error-summary-page-load-focus
Amend error summary markup to fix page load focus bug in JAWS 2022
- Loading branch information
Showing
3 changed files
with
41 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,30 @@ | ||
<div class="govuk-error-summary | ||
{%- if params.classes %} {{ params.classes }}{% endif %}" aria-labelledby="error-summary-title" role="alert" | ||
{%- if params.classes %} {{ params.classes }}{% endif %}" | ||
{%- if params.disableAutoFocus %} data-disable-auto-focus="true"{% endif %} | ||
{%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %} data-module="govuk-error-summary"> | ||
<h2 class="govuk-error-summary__title" id="error-summary-title"> | ||
{{ params.titleHtml | safe if params.titleHtml else params.titleText }} | ||
</h2> | ||
<div class="govuk-error-summary__body"> | ||
{% if caller or params.descriptionHtml or params.descriptionText %} | ||
<p> | ||
{{ caller() if caller else (params.descriptionHtml | safe if params.descriptionHtml else params.descriptionText) }} | ||
</p> | ||
{% endif %} | ||
<ul class="govuk-list govuk-error-summary__list"> | ||
{% for item in params.errorList %} | ||
<li> | ||
{% if item.href %} | ||
<a href="{{ item.href }}"{% for attribute, value in item.attributes %} {{attribute}}="{{value}}"{% endfor %}>{{ item.html | safe if item.html else item.text }}</a> | ||
{% else %} | ||
{{ item.html | safe if item.html else item.text }} | ||
{# Keep the role="alert" in a seperate child container to prevent a race condition between | ||
the focusing js at the alert, resulting in information getting missed in screen reader announcements #} | ||
<div role="alert"> | ||
<h2 class="govuk-error-summary__title"> | ||
{{ params.titleHtml | safe if params.titleHtml else params.titleText }} | ||
</h2> | ||
<div class="govuk-error-summary__body"> | ||
{% if caller or params.descriptionHtml or params.descriptionText %} | ||
<p> | ||
{{ caller() if caller else (params.descriptionHtml | safe if params.descriptionHtml else params.descriptionText) }} | ||
</p> | ||
{% endif %} | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
<ul class="govuk-list govuk-error-summary__list"> | ||
{% for item in params.errorList %} | ||
<li> | ||
{% if item.href %} | ||
<a href="{{ item.href }}"{% for attribute, value in item.attributes %} {{attribute}}="{{value}}"{% endfor %}>{{ item.html | safe if item.html else item.text }}</a> | ||
{% else %} | ||
{{ item.html | safe if item.html else item.text }} | ||
{% endif %} | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters