diff --git a/src/components/button/_button.scss b/src/components/button/_button.scss index 2d3e36796f..25d64fc618 100644 --- a/src/components/button/_button.scss +++ b/src/components/button/_button.scss @@ -142,18 +142,20 @@ .btn--mobile { @extend .btn--ghost; @extend .btn--small; + $size: 0.6rem; + position: relative; padding-right: $size * 2.5; &::before { content: ''; - background: url('#{$static}/img/icons/icons--chevron-down-white.svg') no-repeat center center; - height: $size; - width: $size; position: absolute; top: 11px; right: 8px; + width: $size; + height: $size; + background: url('#{$static}/img/icons/icons--chevron-down-white.svg') no-repeat center center; background-size: $size $size; } @@ -166,8 +168,4 @@ @include mq(m) { display: none; } - - .no-js & { - display: none; - } } diff --git a/src/components/details/_details.scss b/src/components/details/_details.scss index 75be52a133..39350a5c55 100644 --- a/src/components/details/_details.scss +++ b/src/components/details/_details.scss @@ -21,7 +21,7 @@ $details-caret-width: 1.1rem; pointer-events: none; } - &--has-js & { + &--initialised & { &__summary { padding: 0 0 0 ($details-caret-width + 0.4rem); color: $color-links; diff --git a/src/components/details/collapsible.js b/src/components/details/collapsible.js index 737f5f48f4..a8d45adc4d 100644 --- a/src/components/details/collapsible.js +++ b/src/components/details/collapsible.js @@ -34,7 +34,7 @@ export class Collapsible { this.summary.addEventListener('click', this.toggle.bind(this)); - this.details.classList.add('details--has-js'); + this.details.classList.add('details--initialised'); } toggle(event) { diff --git a/src/components/header/_header-nav.scss b/src/components/header/_header-nav.scss index 87ac3fbb80..02441609d5 100644 --- a/src/components/header/_header-nav.scss +++ b/src/components/header/_header-nav.scss @@ -70,16 +70,12 @@ } } -.has-js { - .header-nav--mobile { - @include mq(xs, m) { - max-height: 0; - overflow: hidden; - opacity: 0; - - .nav__item { - display: none; - } +.header-nav--mobile { + @include mq(xs, m) { + opacity: 0; + max-height: 0; + .nav__item { + display: none; } } } diff --git a/src/components/header/_macro.njk b/src/components/header/_macro.njk index 73c70962e0..a2c701cdd4 100644 --- a/src/components/header/_macro.njk +++ b/src/components/header/_macro.njk @@ -85,7 +85,7 @@ "text": params.toggleButton.text, "ariaControls": params.navigation.id, "ariaLabel": params.toggleButton.ariaLabel, - "classes": "btn--mobile js-toggle-main" + "classes": "btn--mobile u-d-no js-toggle-main" }) }} {% endif %} diff --git a/src/components/header/header-nav.js b/src/components/header/header-nav.js index 5b99789ee9..db2feedf87 100644 --- a/src/components/header/header-nav.js +++ b/src/components/header/header-nav.js @@ -1,15 +1,16 @@ import domReady from 'js/domready'; -export const attrExpanded = 'aria-expanded'; -export const attrHidden = 'aria-hidden'; -export const hideClass = 'header-nav--mobile'; -export const openClass = 'open'; +const attrExpanded = 'aria-expanded'; +const attrHidden = 'aria-hidden'; +const hideClass = 'header-nav--mobile'; +const openClass = 'open'; export default class NavToggle { constructor(toggle, nav) { this.toggle = toggle; this.nav = nav; this.toggleNavBinding = this.toggleNav.bind(this); + this.toggle.classList.remove('u-d-no'); } registerEvents() { @@ -37,12 +38,12 @@ export default class NavToggle { } export function mobileNav() { - const toggleMainBtn = document.getElementsByClassName('js-toggle-main')[0]; - const mainNavList = document.getElementsByClassName('js-header-nav')[0]; + const toggleMainBtn = document.querySelector('.js-toggle-main'); + const mainNavList = document.querySelector('.js-header-nav'); - if (!toggleMainBtn) return; - - new NavToggle(toggleMainBtn, mainNavList).registerEvents(); + if (toggleMainBtn) { + new NavToggle(toggleMainBtn, mainNavList).registerEvents(); + } } domReady(mobileNav); diff --git a/src/components/tabs/_macro.njk b/src/components/tabs/_macro.njk index 62e48560a8..a27e8f0fa0 100644 --- a/src/components/tabs/_macro.njk +++ b/src/components/tabs/_macro.njk @@ -1,6 +1,6 @@ {% macro onsTabs(params) %}
-

{{params.title}}

+

{{params.title}}