mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-06 03:13:42 -05:00
18 lines
484 B
JavaScript
18 lines
484 B
JavaScript
(function(Modules) {
|
|
"use strict";
|
|
|
|
Modules.Autofocus = function() {
|
|
this.start = function(component) {
|
|
var 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; }
|
|
|
|
$('input, textarea, select', component).eq(0).trigger('focus');
|
|
|
|
};
|
|
};
|
|
|
|
})(window.GOVUK.Modules);
|