From 538bc63f9802f3f7017bad93503b10b87fcb3eda Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Thu, 4 Nov 2021 11:52:26 +0000 Subject: [PATCH] Autofocus old and new error messages Previously all our error messages had the class `error-message`. Where we are using the components from GOV.UK Frontend they have the class `govuk-error-message`. This makes the code which jumps focus to the first error work in both cases. --- app/assets/javascripts/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js index c255d9652..a6cb2ccba 100644 --- a/app/assets/javascripts/main.js +++ b/app/assets/javascripts/main.js @@ -17,7 +17,7 @@ showHideContent.init(); $(() => GOVUK.modules.start()); -$(() => $('.error-message').eq(0).parent('label').next('input').trigger('focus')); +$(() => $('.error-message, .govuk-error-message').eq(0).parent('label').next('input').trigger('focus')); $(() => $('.banner-dangerous').eq(0).trigger('focus'));