From 6987fda11b9a67a40d914efda9306c49ba012b8b Mon Sep 17 00:00:00 2001 From: Colin Rotherham Date: Wed, 1 Mar 2023 11:10:33 +0000 Subject: [PATCH] Replace Modernizr `.no-js` with `.js-enabled` --- src/stylesheets/components/_navigation.scss | 14 ------- src/stylesheets/components/_site-search.scss | 44 ++++++++++++-------- 2 files changed, 27 insertions(+), 31 deletions(-) diff --git a/src/stylesheets/components/_navigation.scss b/src/stylesheets/components/_navigation.scss index 80f12ef65f..75d4669d74 100644 --- a/src/stylesheets/components/_navigation.scss +++ b/src/stylesheets/components/_navigation.scss @@ -2,22 +2,12 @@ border-bottom: 1px solid $govuk-border-colour; background-color: $app-light-grey; - @include govuk-media-query($from: tablet) { - display: block; - } - [hidden], &[hidden] { display: none; } } -.no-js .app-navigation { - @include govuk-media-query($until: tablet) { - display: block; - } -} - .app-navigation__list { margin: 0; padding: 0; @@ -134,8 +124,4 @@ top: auto; right: govuk-spacing(1); bottom: govuk-spacing(5); - - &[hidden] { - display: none; - } } diff --git a/src/stylesheets/components/_site-search.scss b/src/stylesheets/components/_site-search.scss index d06b8c5b10..79d0559fdc 100644 --- a/src/stylesheets/components/_site-search.scss +++ b/src/stylesheets/components/_site-search.scss @@ -13,6 +13,7 @@ $icon-size: 40px; .app-site-search { + display: none; position: relative; width: 100%; max-width: calc(100% - 75px); @@ -20,6 +21,10 @@ $icon-size: 40px; margin-bottom: govuk-spacing(2); float: left; + .js-enabled & { + display: block; + } + @include govuk-media-query($from: tablet) { width: 300px; max-width: 100%; @@ -30,18 +35,15 @@ $icon-size: 40px; margin: 0; margin-top: -5px; // negative margin to vertically align search in header float: right; - } + text-align: right; - .no-js & { - display: none; - - @include govuk-media-query($from: tablet) { - display: block; + .js-enabled & { + text-align: left; } + } - @include govuk-media-query($from: desktop) { - text-align: right; - } + @include govuk-media-query($from: tablet) { + display: block; } } @@ -187,16 +189,24 @@ $icon-size: 40px; .app-site-search__link { display: none; + margin-top: 10px; + + &:link, + &:visited, + &:hover, + &:active { + color: govuk-colour("white"); + } - .no-js & { - @include govuk-media-query($from: tablet) { - display: inline-block; - margin-top: 10px; - color: govuk-colour("white"); + &:focus { + color: govuk-colour("black"); + } + + @include govuk-media-query($from: tablet) { + display: inline-block; - &:focus { - color: govuk-colour("black"); - } + .js-enabled & { + display: none; } } }