From 6d40d44d58b83368eaca74b85ba4a1f1eb18122b Mon Sep 17 00:00:00 2001 From: Kevin Dew Date: Fri, 13 Jan 2023 19:52:22 +0000 Subject: [PATCH] Use a hidden input for hidden facets This replaces the use of an input[type=text] for a hidden field. The motivation for replacing this is that these depend on inline styles and these will no longer be permitted by the Content Security Policy in https://github.com/alphagov/govuk_app_config/pull/279 This also serves as a semantic improvement to the HTML. --- .../javascripts/modules/remove-filter.js | 2 +- .../finders/_hidden_clearable_facet.html.erb | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/modules/remove-filter.js b/app/assets/javascripts/modules/remove-filter.js index 13f43288d..0713ef5d8 100644 --- a/app/assets/javascripts/modules/remove-filter.js +++ b/app/assets/javascripts/modules/remove-filter.js @@ -39,7 +39,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {}; if (inputType === 'checkbox') { $input.checked = false window.GOVUK.triggerEvent($input, 'change', { detail: { suppressAnalytics: true } }) - } else if (inputType === 'text' || inputType === 'search') { + } else if (inputType === 'text' || inputType === 'search' || inputType === 'hidden') { /* By padding the haystack with spaces, we can remove the * first instance of " $needle ", and this will catch it in * the middle of the haystack, at the ends, and when the diff --git a/app/views/finders/_hidden_clearable_facet.html.erb b/app/views/finders/_hidden_clearable_facet.html.erb index e939a492d..a411acd73 100644 --- a/app/views/finders/_hidden_clearable_facet.html.erb +++ b/app/views/finders/_hidden_clearable_facet.html.erb @@ -1,12 +1,12 @@ -