Commit Graph

6 Commits

Author SHA1 Message Date
Chris Hill-Scott
edd2a04c7a Make autofocus work on all form elements which ask for it
In 674c27a693 we updated the autofocus
Javascript to be compatible with GOV.UK Frontend textboxes, which have
the `data-module` attribute set on the `input` element, rather than on
a wrapper element.

However we still have some `<textarea>`s and `<input>`s which haven’t
moved to GOV.UK Frontend and therefore aren’t getting picked up by the
Javascript which is supposed to focus them.

This commit makes the Javascript work with both kinds of textbox, which
is needed until we move entirely to GOV.UK Frontend.
2021-11-04 16:26:12 +00:00
Tom Byers
90504d9b6c Don't prefix with the page title on focus
Doing this was helpful to Voiceover users as its
announcement of the label meant the page title
(normally announced onload) wasn't skipped.

This isn't the case with JAWS so, prefixing the
title makes it announce it twice.

JAWS has a lot more users and the title being
announced twice is more confusing than not at all
so this removes it.
2020-10-06 11:58:59 +01:00
Tom Byers
6cf7017ff5 Add tests for changes to label 2020-09-24 13:10:55 +01:00
Chris Hill-Scott
674c27a693 Fix the autofocus component
Since moving textboxes to GOV.UK Frontend we’ve started putting the
data attribute on the `input` element itself, not a wrapper around it.

This commit updates the Javascript accordingly.
2020-08-27 08:50:28 +01:00
Tom Byers
0131f0c1b1 Move setup/teardown out of tests 2019-06-12 16:03:18 +01:00
Tom Byers
00c1ebf02a Add test for autofocus.js
One of the simplest of our JavaScript files to
test how difficult this is.

Answer is not too bad and includes the file
needing a DOM to operate on and jQuery in the
global scope.
2019-04-24 10:46:55 +01:00