-
Notifications
You must be signed in to change notification settings - Fork 332
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 #1459 from alphagov/fix-error-summary-legacy
Fix legacy error summary component autofocus on full page examples
- Loading branch information
Showing
9 changed files
with
80 additions
and
85 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
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
20 changes: 4 additions & 16 deletions
20
app/views/full-page-examples/applicant-details/confirm.njk
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
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
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{% extends "govuk_template_jinja/views/layouts/govuk_template.html" %} | ||
|
||
{% set asset_path = "/vendor/govuk_template/" %} | ||
{% set homepage_url = "/" %} | ||
{% block page_title %}{{ "Error: " if errors }}{{ page_title }} - GOV.UK{% endblock %} | ||
|
||
{% block head %} | ||
<!--[if !IE 8]><!--> | ||
<link rel="stylesheet" href="/public/app-legacy.css"> | ||
<!--<![endif]--> | ||
<!--[if IE 8]> | ||
<link rel="stylesheet" href="/public/app-legacy-ie8.css"> | ||
<![endif]--> | ||
{% endblock %} | ||
|
||
{% block body_end %} | ||
{% include "partials/legacyJavaScript.njk" %} | ||
<script src="/public/all.js"></script> | ||
<script>window.GOVUKFrontend.initAll()</script> | ||
{% endblock %} |
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<script src="/vendor/govuk_template/javascripts/govuk-template.js"></script> | ||
|
||
{# Frontend Toolkit dependency #} | ||
<script src="/vendor/jquery/jquery.min.js"></script> | ||
{# Frontend Toolkit modules #} | ||
<script src="/vendor/govuk_frontend_toolkit/details.polyfill.js"></script> | ||
<script src="/vendor/govuk_frontend_toolkit/modules.js"></script> | ||
<script src="/vendor/govuk_frontend_toolkit/modules/auto-track-event.js"></script> | ||
<script src="/vendor/govuk_frontend_toolkit/primary-links.js"></script> | ||
<script src="/vendor/govuk_frontend_toolkit/shim-links-with-button-role.js"></script> | ||
<script src="/vendor/govuk_frontend_toolkit/show-hide-content.js"></script> | ||
<script src="/vendor/govuk_frontend_toolkit/stick-at-top-when-scrolling.js"></script> | ||
<script src="/vendor/govuk_frontend_toolkit/stop-scrolling-at-footer.js"></script> | ||
|
||
<script> | ||
(function() { | ||
// Instantiate Frontend Toolkit modules | ||
// Ordering follows what we do in test manifest: /spec/manifest.js | ||
GOVUK.details.init() | ||
GOVUK.modules.start() | ||
GOVUK.primaryLinks.init() | ||
var showHideContent = new GOVUK.ShowHideContent() | ||
showHideContent.init() | ||
GOVUK.stickAtTopWhenScrolling.init() | ||
GOVUK.shimLinksWithButtonRole.init() | ||
// Copied from https://github.com/alphagov/govuk_elements/blob/ef0baed92fabbbfdc0f6ea09d7dd76bffa994bf8/assets/javascripts/application.js#L22 | ||
$(window).load(function () { | ||
// If there is an error summary, set focus to the summary | ||
if ($('.error-summary').length) { | ||
$('.error-summary').focus() | ||
$('.error-summary a').click(function (e) { | ||
e.preventDefault() | ||
var href = $(this).attr('href') | ||
$(href).focus() | ||
}) | ||
} else { | ||
// Otherwise, set focus to the field with the error | ||
$('.error input:first').focus() | ||
} | ||
}) | ||
})() | ||
</script> |