Files
notifications-admin/app/assets/javascripts/main.js
Chris Hill-Scott cd7cb8884c Send focus to error summary before single error
> If both sections of the page have errors and the page is submitted,
> focus moves to the mobile numbers section so screen reader users may
> not be aware of preceding errors - focus should move to a dedicated
> error summary at the top of the page.

Right now we use Javascript to focus the first error on a page (if any
errors are found). This commit adds more JS to then focus the error
summary, if there is one on the page. So this is where the focus will
rest.

It also makes some modifications to the ‘dangerous’ banner to make it
focusable, and to visually indicate that it is focused.
2017-02-14 11:51:19 +00:00

10 lines
299 B
JavaScript

$(() => $("time.timeago").timeago());
$(() => GOVUK.modules.start());
$(() => new GOVUK.SelectionButtons('.block-label input, .sms-message-option input'));
$(() => $('.error-message').eq(0).parent('label').next('input').trigger('focus'));
$(() => $('.banner-dangerous').eq(0).trigger('focus'));