-
Notifications
You must be signed in to change notification settings - Fork 89
/
Copy pathapplication.js
38 lines (33 loc) · 1.07 KB
/
application.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* global $ */
/* global jQuery */
/* global GOVUK */
$(document).ready(function () {
// Turn off jQuery animation
jQuery.fx.off = true
// Where .multiple-choice uses the data-target attribute
// to toggle hidden content
var showHideContent = new GOVUK.ShowHideContent()
showHideContent.init()
// Use GOV.UK shim-links-with-button-role.js to trigger a link styled to look like a button,
// with role="button" when the space key is pressed.
GOVUK.shimLinksWithButtonRole.init()
// Details/summary polyfill from frontend toolkit
GOVUK.details.init()
})
$(window).load(function () {
// Only set focus for the error example pages
if ($('.js-error-example').length) {
// 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()
}
}
})