mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-06 11:23:48 -05:00
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.
19 lines
524 B
JavaScript
19 lines
524 B
JavaScript
(function(Modules) {
|
|
"use strict";
|
|
|
|
Modules.Autofocus = function() {
|
|
this.start = function(component) {
|
|
var $component = $(component),
|
|
forceFocus = $component.data('forceFocus');
|
|
|
|
// if the page loads with a scroll position, we can't assume the item to focus onload
|
|
// is still where users intend to start
|
|
if (($(window).scrollTop() > 0) && !forceFocus) { return; }
|
|
|
|
$component.filter('input, textarea, select').eq(0).trigger('focus');
|
|
|
|
};
|
|
};
|
|
|
|
})(window.GOVUK.Modules);
|