Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use govuk-frontend v5 [DO NOT MERGE] #3700

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d92ca8f
Update govuk-frontend to v5.1.0
patrickpatrickpatrick Nov 6, 2023
05b66e4
Update govuk-frontend asset paths
patrickpatrickpatrick Nov 6, 2023
f0115a3
Remove references to the crown fallback
patrickpatrickpatrick Nov 7, 2023
465fb4d
Remove references to govuk-frontend JS polyfills
patrickpatrickpatrick Nov 7, 2023
e5398c7
Update govuk-frontend .js file names
patrickpatrickpatrick Nov 28, 2023
f2a05e3
Remove reference to details.js
patrickpatrickpatrick Nov 28, 2023
7e559e3
Remove $legacy from govuk-colour
patrickpatrickpatrick Nov 6, 2023
1e1e2bf
Update tag component in light of govuk-frontend v5
patrickpatrickpatrick Nov 7, 2023
d6a8995
Remove `$govuk-new-link-styles` feature flag
patrickpatrickpatrick Nov 8, 2023
cf980a5
Replace `govuk-warning-text__assistive` class
patrickpatrickpatrick Nov 8, 2023
89adcfa
Use Terser instead of Uglifier
patrickpatrickpatrick Nov 8, 2023
7f9b2d5
Separate ES6 components from ES5 components
patrickpatrickpatrick Nov 13, 2023
269edc6
Update install-and-use docs with new JS guidance
patrickpatrickpatrick Nov 15, 2023
cd519da
Update app icon paths from govuk-frontend
patrickpatrickpatrick Nov 29, 2023
ce7b8b2
Update .svg used in header component
patrickpatrickpatrick Nov 29, 2023
12f8799
Use .svg used in navbar
patrickpatrickpatrick Nov 29, 2023
d189785
Update header logos
MartinJJones Apr 5, 2024
5606c91
Ensure font-size is 19px checkboxes and warning-text
MartinJJones Apr 5, 2024
9b2c5a6
Remove aria-labelledby from accordion sections
MartinJJones Apr 8, 2024
8bf5701
Use govuk-frontend v5 component initialisation
patrickpatrickpatrick Nov 6, 2023
ff8bacd
Update tests to use new initialisation method
patrickpatrickpatrick Nov 7, 2023
7747e1f
Update Analytics modules to use new init method
patrickpatrickpatrick Nov 29, 2023
f3b11ce
Update GA4 modules to use new init method
MartinJJones Mar 14, 2024
3dab7a2
Update `lib` modules to use `init`
jon-kirwan Mar 14, 2024
62110c5
Update cross-service-header.js to use `init`
MartinJJones Apr 5, 2024
b1b6fc3
Fix toggle specs
jon-kirwan Mar 18, 2024
4c3b470
Update feedback.js
MartinJJones May 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ PATH
rouge
sprockets (>= 3)
sprockets-rails
terser

GEM
remote: https://rubygems.org/
Expand Down
5 changes: 3 additions & 2 deletions app/assets/config/govuk_publishing_components_manifest.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Pre-compile image and font assets from here and govuk-frontend
//= link_tree ../images
//= link_tree ../../../node_modules/govuk-frontend/govuk/assets/images
//= link_tree ../../../node_modules/govuk-frontend/govuk/assets/fonts
//= link_tree ../../../node_modules/govuk-frontend/dist/govuk/assets/images
//= link_tree ../../../node_modules/govuk-frontend/dist/govuk/assets/fonts
//= link_tree ../../../node_modules/govuk-frontend/dist/govuk/assets

// Create asset files of each of the files in these directory
//= link_directory ../javascripts/component_guide
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Pre-compile image and font assets from here and govuk-frontend
//= link_tree ../images
//= link_tree ../../../node_modules/govuk-frontend/govuk/assets/images
//= link_tree ../../../node_modules/govuk-frontend/govuk/assets/fonts
//= link_tree ../../../node_modules/govuk-frontend/dist/govuk/assets/images
//= link_tree ../../../node_modules/govuk-frontend/dist/govuk/assets/fonts

// Create asset files of each of the files in these directory
//= link_directory ../javascripts/component_guide
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
this.module = module
this.trackingTrigger = 'data-ga4-auto'
this.PIIRemover = new window.GOVUK.analyticsGa4.PIIRemover()

this.init()
}

Ga4AutoTracker.prototype.init = function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//= require govuk/vendor/polyfills/Element/prototype/closest.js
;(function (global) {
'use strict'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
function Ga4EventTracker (module) {
this.module = module
this.trackingTrigger = 'data-ga4-event' // elements with this attribute get tracked

this.init()
}

Ga4EventTracker.prototype.init = function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
this.trackLinksOnly = this.module.hasAttribute('data-ga4-track-links-only')
this.limitToElementClass = this.module.getAttribute('data-ga4-limit-to-element-class')
this.PIIRemover = new window.GOVUK.analyticsGa4.PIIRemover()

this.init()
}

Ga4LinkTracker.prototype.init = function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// = require govuk/vendor/polyfills/Element/prototype/closest.js
window.GOVUK = window.GOVUK || {}
window.GOVUK.analyticsGa4 = window.GOVUK.analyticsGa4 || {}
window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analyticsModules || {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ window.GOVUK.analyticsVars = window.GOVUK.analyticsVars || {};
resizeTimeoutDelay: 100,
pageHeightTimeoutDelay: 500
}

this.init()
}

AutoScrollTracker.prototype.init = function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
(function (Modules) {
function AutoTrackEvent ($module) {
this.$module = $module

this.init()
}

AutoTrackEvent.prototype.init = function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
function CrossDomainTracking ($module) {
this.$module = $module
Modules.crossDomainLinkedTrackers = Modules.crossDomainLinkedTrackers || []

this.init()
}

CrossDomainTracking.prototype.init = function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
(function (Modules) {
function ExplicitCrossDomainLinks ($module) {
this.$module = $module

this.init()
}

ExplicitCrossDomainLinks.prototype.init = function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// = require govuk/vendor/polyfills/Element/prototype/closest.js
;(function (global) {
'use strict'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
(function (Modules) {
function GemTrackClick ($module) {
this.$module = $module

this.init()
}

GemTrackClick.prototype.init = function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
(function (Modules) {
function TrackSelectChange ($module) {
this.$module = $module

this.init()
}

TrackSelectChange.prototype.init = function ($module) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* global nodeListForEach */
// = require ../vendor/polyfills/common.js
// This component relies on JavaScript from GOV.UK Frontend
// = require govuk/components/accordion/accordion.js
// = require govuk/components/accordion/accordion.bundle.js
window.GOVUK = window.GOVUK || {}
window.GOVUK.Modules = window.GOVUK.Modules || {}
window.GOVUK.Modules.GovukAccordion = window.GOVUKFrontend.Accordion;
Expand All @@ -21,6 +21,8 @@ window.GOVUK.Modules.GovukAccordion = window.GOVUKFrontend.Accordion;
// language attribute pulled from data attributes
this.$module.actions = {}
this.$module.actions.locale = this.$module.getAttribute('data-locale')

this.init()
}

GemAccordion.prototype.init = function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This component relies on JavaScript from GOV.UK Frontend
// = require govuk/components/button/button.js
// = require govuk/components/button/button.bundle.js
window.GOVUK = window.GOVUK || {}
window.GOVUK.Modules = window.GOVUK.Modules || {}
window.GOVUK.Modules.GovukButton = window.GOVUKFrontend.Button
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This component relies on JavaScript from GOV.UK Frontend
// = require govuk/components/character-count/character-count.js
// = require govuk/components/character-count/character-count.bundle.js
window.GOVUK = window.GOVUK || {}
window.GOVUK.Modules = window.GOVUK.Modules || {}
window.GOVUK.Modules.GovukCharacterCount = window.GOVUKFrontend.CharacterCount
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// = require govuk/vendor/polyfills/Element/prototype/closest.js
// = require govuk/components/checkboxes/checkboxes.js
// = require govuk/components/checkboxes/checkboxes.bundle.js
window.GOVUK = window.GOVUK || {}
window.GOVUK.Modules = window.GOVUK.Modules || {}
window.GOVUK.Modules.GovukCheckboxes = window.GOVUKFrontend.Checkboxes;
Expand All @@ -9,6 +8,8 @@ window.GOVUK.Modules.GovukCheckboxes = window.GOVUKFrontend.Checkboxes;
this.$module = $module
this.$checkboxes = this.$module.querySelectorAll('input[type=checkbox]')
this.$nestedCheckboxes = this.$module.querySelectorAll('[data-nested=true] input[type=checkbox]')

this.init()
}

GemCheckboxes.prototype.init = function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
this.$guidance = this.$module.querySelector('.gem-c-contextual-guidance__wrapper')
this.$inputId = this.$guidance.getAttribute('for')
this.$input = this.$module.querySelector('#' + this.$inputId)

this.init()
}

ContextualGuidance.prototype.init = function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
this.$module = $module
this.$module.cookieBannerConfirmationMessage = this.$module.querySelector('.gem-c-cookie-banner__confirmation')
this.$module.cookieBannerConfirmationMessageText = this.$module.querySelector('.gem-c-cookie-banner__confirmation-message')

this.init()
}

CookieBanner.prototype.init = function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
this.$module = $module
this.$input = this.$module.querySelector('.gem-c-input')
this.$copyButton = this.$module.querySelector('.gem-c-button')

this.init()
}

CopyToClipboard.prototype.init = function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
this.$header = $module
this.$navigation = $module && $module.querySelectorAll('[data-one-login-header-nav]')
this.$numberOfNavs = this.$navigation && this.$navigation.length

this.init()
}
/**
* Initialise header
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// = require govuk/components/details/details.js
window.GOVUK = window.GOVUK || {}
window.GOVUK.Modules = window.GOVUK.Modules || {}
window.GOVUK.Modules.GovukDetails = window.GOVUKFrontend.Details;
window.GOVUK.Modules = window.GOVUK.Modules || {};

(function (Modules) {
function GemDetails ($module) {
Expand All @@ -10,6 +8,8 @@ window.GOVUK.Modules.GovukDetails = window.GOVUKFrontend.Details;

this.customTrackLabel = this.$summary.getAttribute('data-track-label')
this.detailsClick = this.$module.querySelector('[data-details-track-click]')

this.init()
}

GemDetails.prototype.init = function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This component relies on JavaScript from GOV.UK Frontend
// = require govuk/components/error-summary/error-summary.js
// = require govuk/components/error-summary/error-summary.bundle.js
window.GOVUK = window.GOVUK || {}
window.GOVUK.Modules = window.GOVUK.Modules || {}
window.GOVUK.Modules.GovukErrorSummary = window.GOVUKFrontend.ErrorSummary
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
this.jshiddenClass = 'js-hidden'
this.whatDoingInput = this.$module.querySelector('[name=what_doing]')
this.whatWrongInput = this.$module.querySelector('[name=what_wrong]')

// this.init()
}

Feedback.prototype.init = function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
(function (Modules) {
function Govspeak ($module) {
this.$module = $module

this.init()
}

Govspeak.prototype.init = function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
function ImageCard ($module) {
this.$module = $module
this.$module.youtubeLink = this.$module.querySelector('.gem-c-image-card__image-wrapper div')

this.init()
}

ImageCard.prototype.init = function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
this.$closeLink = this.$module.querySelector('.js-dismiss-link')
this.$campaignName = this.$module.getAttribute('data-intervention-name')
this.$campaignCookie = window.GOVUK.cookie('intervention_campaign') || ''

this.init()
}

Intervention.prototype.init = function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This component relies on JavaScript from GOV.UK Frontend
// = require govuk/components/header/header.js
// = require govuk/components/header/header.bundle.js
window.GOVUK = window.GOVUK || {}
window.GOVUK.Modules = window.GOVUK.Modules || {}
window.GOVUK.Modules.GovukHeader = window.GOVUKFrontend.Header
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//= require govuk/vendor/polyfills/Element/prototype/classList.js

window.GOVUK = window.GOVUK || {}
window.GOVUK.Modules = window.GOVUK.Modules || {};

Expand Down Expand Up @@ -107,6 +105,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
)

this.hiddenButtons = this.$module.querySelectorAll('button[hidden]')

this.init()
}

SuperNavigationMegaMenu.prototype.buttonHandler = function (event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
(function (Modules) {
function Metadata ($module) {
this.$module = $module

this.init()
}

Metadata.prototype.init = function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
this.$closeButton = this.$module.querySelector('.gem-c-modal-dialogue__close-button')
this.$html = document.querySelector('html')
this.$body = document.querySelector('body')

this.init()
}

ModalDialogue.prototype.init = function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
this.mq = window.matchMedia('(min-width: 641px)')
this.isClosedOnLoad = this.$optionSelect.getAttribute('data-closed-on-load')
this.isClosedOnLoadMobile = this.$optionSelect.getAttribute('data-closed-on-load-mobile')

this.init()
}

OptionSelect.prototype.init = function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
(function (Modules) {
function PrintLink ($module) {
this.$module = $module

this.init()
}

PrintLink.prototype.init = function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This component relies on JavaScript from GOV.UK Frontend
// = require govuk/components/radios/radios.js
// = require govuk/components/radios/radios.bundle.js
window.GOVUK = window.GOVUK || {}
window.GOVUK.Modules = window.GOVUK.Modules || {}
window.GOVUK.Modules.GovukRadios = window.GOVUKFrontend.Radios
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
this.$module = $module
this.$upButtons = this.$module.querySelectorAll('.js-reorderable-list-up')
this.$downButtons = this.$module.querySelectorAll('.js-reorderable-list-down')

this.init()
}

ReorderableList.prototype.init = function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
this.personalisationEndpoint = '/api/personalisation/check-email-subscription?base_path=' + this.basePath
// This attribute is passed through to the personalisation API to ensure the updated button has the same button_location for analytics
if (this.buttonLocation) this.personalisationEndpoint += '&button_location=' + this.buttonLocation

this.init()
}

SinglePageNotificationButton.prototype.init = function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This component relies on JavaScript from GOV.UK Frontend
// = require govuk/components/skip-link/skip-link.js
// = require govuk/components/skip-link/skip-link.bundle.js
window.GOVUK = window.GOVUK || {}
window.GOVUK.Modules = window.GOVUK.Modules || {}
window.GOVUK.Modules.GovukSkipLink = window.GOVUKFrontend.SkipLink
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
//= require govuk/vendor/polyfills/Element/prototype/classList.js
//= require ../vendor/polyfills/closest.js
//= require ../vendor/polyfills/indexOf.js

window.GOVUK = window.GOVUK || {}
window.GOVUK.Modules = window.GOVUK.Modules || {};

Expand All @@ -16,6 +12,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
this.$module.activeStepClass = 'gem-c-step-nav__step--active'
this.$module.activeLinkHref = '#content'
this.$module.uniqueId = false

this.init()
}

Gemstepnav.prototype.init = function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
for (var i = 0; i < this.tableRows.length; i++) {
this.tableRowsContent.push(this.tableRows[i].textContent.toUpperCase())
}

this.init()
}

Table.prototype.init = function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This component relies on JavaScript from GOV.UK Frontend
// = require govuk/components/tabs/tabs.js
// = require govuk/components/tabs/tabs.bundle.js
window.GOVUK = window.GOVUK || {}
window.GOVUK.Modules = window.GOVUK.Modules || {}
window.GOVUK.Modules.GovukTabs = window.GOVUKFrontend.Tabs
Loading