Hide cookie banner if no-js

Decided in discussions with @quis and @yahoopete
that users without JS available cannot
accept/reject analytics cookies so the banner has
no use.
This commit is contained in:
Tom Byers
2020-01-08 09:43:34 +00:00
parent 3e8ed578d0
commit 8a0d0a15a8
2 changed files with 9 additions and 16 deletions

View File

@@ -1,15 +1,9 @@
{% macro cookie_banner(message, id='global-cookie-message') %} {% macro cookie_banner(message, id='global-cookie-message') %}
<div id="{{ id }}" class="notify-cookie-banner" data-module="cookie-banner" role="region" aria-describedby="notify-cookie-banner__heading"> <div id="{{ id }}" class="notify-cookie-banner notify-cookie-banner__with-js" data-module="cookie-banner" role="region" aria-describedby="notify-cookie-banner__heading">
<div class="notify-cookie-banner__wrapper govuk-width-container"> <div class="notify-cookie-banner__wrapper govuk-width-container">
<h2 class="notify-cookie-banner__heading govuk-heading-m" id="notify-cookie-banner__heading">Cookies on GOV.UK Notify</h2> <h2 class="notify-cookie-banner__heading govuk-heading-m" id="notify-cookie-banner__heading">Cookies on GOV.UK Notify</h2>
<p class="govuk-body">We use <a class="govuk-link" href="/cookies">small files called cookies</a> to make GOV.UK Notify work.</p> <p class="govuk-body">We use <a class="govuk-link" href="/cookies">small files called cookies</a> to make GOV.UK Notify work.</p>
<div class="notify-cookie-banner__buttons notify-cookie-banner__no-js">
<div class="notify-cookie-banner__button">
<a href="/cookies" class="notify-cookie-banner-button" role="button">Set cookie preferences</a>
</div>
</div>
<div class="notify-cookie-banner__with-js">
<p class="govuk-body">We'd also like to use analytics cookies to help us improve our service.</p> <p class="govuk-body">We'd also like to use analytics cookies to help us improve our service.</p>
<p class="govuk-body">Please let us know if this is OK.</p> <p class="govuk-body">Please let us know if this is OK.</p>
<div class="notify-cookie-banner__buttons"> <div class="notify-cookie-banner__buttons">
@@ -21,7 +15,6 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="notify-cookie-banner__confirmation govuk-width-container" tabindex="-1"> <div class="notify-cookie-banner__confirmation govuk-width-container" tabindex="-1">
<p class="notify-cookie-banner__confirmation-message govuk-body"> <p class="notify-cookie-banner__confirmation-message govuk-body">

View File

@@ -86,7 +86,7 @@ describe("Cookie message", () => {
}); });
/* /*
Note: If no JS, the cookie banner shows a button to take you to the cookies page for more information. Note: If no JS, the cookie banner is hidden.
This works through CSS, based on the presence of the `js-enabled` class on the <body> so is not tested here. This works through CSS, based on the presence of the `js-enabled` class on the <body> so is not tested here.
*/ */