Skip to content

Commit

Permalink
Showing 53 changed files with 9,075 additions and 374 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

## 3.9.0 (feature release)
## Unreleased

## 3.9.0 (Feature release)

### New features

@@ -73,7 +75,7 @@ This was added in [pull request #1921: Make it possible to exclude link from hea

We’ve made fixes to GOV.UK Frontend in the following pull requests:

- [#1918: Add new brand colour for FCDO](https://github.com/alphagov/govuk-frontend/pull/1918) - thanks to [@deborahchua](https://github.com/deborahchua) for contributing this
- [#1918: Add new brand colour for FCDO](https://github.com/alphagov/govuk-frontend/pull/1918) - thanks to [@deborahchua](https://github.com/deborahchua) and [@beccapearce](https://github.com/beccapearce) for contributing this
- [#1942: Set aria-expanded and aria-hidden attributes on header menu button and menu when page loads](https://github.com/alphagov/govuk-frontend/pull/1942)
- [#1947 Add print styles for the panel component](https://github.com/alphagov/govuk-frontend/pull/1947)

2 changes: 1 addition & 1 deletion dist/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.8.1
3.9.0
3 changes: 0 additions & 3 deletions dist/govuk-frontend-3.8.1.min.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/govuk-frontend-3.8.1.min.js

This file was deleted.

3 changes: 3 additions & 0 deletions dist/govuk-frontend-3.9.0.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/govuk-frontend-3.9.0.min.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion dist/govuk-frontend-ie8-3.8.1.min.css

This file was deleted.

1 change: 1 addition & 0 deletions dist/govuk-frontend-ie8-3.9.0.min.css

Large diffs are not rendered by default.

69 changes: 32 additions & 37 deletions package/govuk/all.js
Original file line number Diff line number Diff line change
@@ -1961,55 +1961,50 @@ ErrorSummary.prototype.getAssociatedLegendOrLabel = function ($input) {

function Header ($module) {
this.$module = $module;
this.$menuButton = $module && $module.querySelector('.govuk-js-header-toggle');
this.$menu = this.$menuButton && $module.querySelector(
'#' + this.$menuButton.getAttribute('aria-controls')
);
}

/**
* Initialise header
*
* Check for the presence of the header, menu and menu button – if any are
* missing then there's nothing to do so return early.
*/
Header.prototype.init = function () {
// Check for module
var $module = this.$module;
if (!$module) {
if (!this.$module || !this.$menuButton || !this.$menu) {
return
}

// Check for button
var $toggleButton = $module.querySelector('.govuk-js-header-toggle');
if (!$toggleButton) {
return
}

// Handle $toggleButton click events
$toggleButton.addEventListener('click', this.handleClick.bind(this));
this.syncState(this.$menu.classList.contains('govuk-header__navigation--open'));
this.$menuButton.addEventListener('click', this.handleMenuButtonClick.bind(this));
};

/**
* Toggle class
* @param {object} node element
* @param {string} className to toggle
*/
Header.prototype.toggleClass = function (node, className) {
if (node.className.indexOf(className) > 0) {
node.className = node.className.replace(' ' + className, '');
} else {
node.className += ' ' + className;
}
* Sync menu state
*
* Sync the menu button class and the accessible state of the menu and the menu
* button with the visible state of the menu
*
* @param {boolean} isVisible Whether the menu is currently visible
*/
Header.prototype.syncState = function (isVisible) {
this.$menuButton.classList.toggle('govuk-header__menu-button--open', isVisible);
this.$menuButton.setAttribute('aria-expanded', isVisible);
this.$menu.setAttribute('aria-hidden', !isVisible);
};

/**
* An event handler for click event on $toggleButton
* @param {object} event event
*/
Header.prototype.handleClick = function (event) {
var $module = this.$module;
var $toggleButton = event.target || event.srcElement;
var $target = $module.querySelector('#' + $toggleButton.getAttribute('aria-controls'));

// If a button with aria-controls, handle click
if ($toggleButton && $target) {
this.toggleClass($target, 'govuk-header__navigation--open');
this.toggleClass($toggleButton, 'govuk-header__menu-button--open');

$toggleButton.setAttribute('aria-expanded', $toggleButton.getAttribute('aria-expanded') !== 'true');
$target.setAttribute('aria-hidden', $target.getAttribute('aria-hidden') === 'false');
}
* Handle menu button click
*
* When the menu button is clicked, change the visibility of the menu and then
* sync the accessibility state and menu button state
*/
Header.prototype.handleMenuButtonClick = function () {
var isVisible = this.$menu.classList.toggle('govuk-header__navigation--open');
this.syncState(isVisible);
};

function Radios ($module) {
2 changes: 1 addition & 1 deletion package/govuk/components/accordion/README.md
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ See the [main README quick start guide](https://github.com/alphagov/govuk-fronte

## Guidance and Examples

Find out when to use the details component in your service in the [GOV.UK Design System](https://design-system.service.gov.uk/components/accordion).
Find out when to use the accordion component in your service in the [GOV.UK Design System](https://design-system.service.gov.uk/components/accordion).

## Component options

Loading

0 comments on commit 6d1b0b7

Please sign in to comment.