From ecdb0e242b7526a443639f77c1c9eac81a16aba4 Mon Sep 17 00:00:00 2001 From: Tom Byers Date: Fri, 6 Sep 2024 12:17:01 +0100 Subject: [PATCH 1/2] Use hidden attribute to show/hide expiry notices This means the notice we want to hide on page load doesn't depend on CSS for that. It also makes it much clearer in the page semantics that the notices are hidden or not. --- lib/assets/javascripts/_modules/page-expiry.js | 4 ++-- lib/assets/stylesheets/modules/_page-review.scss | 2 -- lib/source/layouts/_page_review.erb | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/assets/javascripts/_modules/page-expiry.js b/lib/assets/javascripts/_modules/page-expiry.js index 1bc228b0..983201d6 100644 --- a/lib/assets/javascripts/_modules/page-expiry.js +++ b/lib/assets/javascripts/_modules/page-expiry.js @@ -7,8 +7,8 @@ var isExpired = Date.parse(rawDate) < new Date() if (isExpired) { - $element.find('.page-expiry--not-expired').hide(0) - $element.find('.page-expiry--expired').show(0) + $element.find('.page-expiry--not-expired').attr('hidden', '') + $element.find('.page-expiry--expired').removeAttr('hidden') } } } diff --git a/lib/assets/stylesheets/modules/_page-review.scss b/lib/assets/stylesheets/modules/_page-review.scss index 753617a4..dd449667 100644 --- a/lib/assets/stylesheets/modules/_page-review.scss +++ b/lib/assets/stylesheets/modules/_page-review.scss @@ -24,8 +24,6 @@ } .page-expiry--expired { - display: none; - padding: govuk-spacing(3); margin-top: govuk-spacing(9); border: govuk-spacing(1) solid $govuk-error-colour; diff --git a/lib/source/layouts/_page_review.erb b/lib/source/layouts/_page_review.erb index 3327eee4..6550f56f 100644 --- a/lib/source/layouts/_page_review.erb +++ b/lib/source/layouts/_page_review.erb @@ -12,7 +12,7 @@ <% if current_page_review.show_expiry? %> -
+