govuk_publishing_components 34.0.0 → 34.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-core.js +16 -27
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-event-tracker.js +2 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-page-views.js +4 -4
- data/app/assets/javascripts/govuk_publishing_components/components/layout-super-navigation-header.js +12 -69
- data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +14 -13
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +247 -412
- data/app/views/govuk_publishing_components/components/_label.html.erb +3 -2
- data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +94 -143
- data/app/views/govuk_publishing_components/components/docs/label.yml +6 -0
- data/config/locales/ar.yml +4 -1
- data/config/locales/az.yml +4 -1
- data/config/locales/be.yml +4 -1
- data/config/locales/bg.yml +4 -1
- data/config/locales/bn.yml +4 -1
- data/config/locales/cs.yml +4 -1
- data/config/locales/cy.yml +4 -1
- data/config/locales/da.yml +4 -1
- data/config/locales/de.yml +4 -1
- data/config/locales/dr.yml +4 -1
- data/config/locales/el.yml +4 -1
- data/config/locales/en.yml +6 -10
- data/config/locales/es-419.yml +4 -1
- data/config/locales/es.yml +4 -1
- data/config/locales/et.yml +4 -1
- data/config/locales/fa.yml +4 -1
- data/config/locales/fi.yml +4 -1
- data/config/locales/fr.yml +4 -1
- data/config/locales/gd.yml +4 -1
- data/config/locales/gu.yml +4 -1
- data/config/locales/he.yml +4 -1
- data/config/locales/hi.yml +4 -1
- data/config/locales/hr.yml +4 -1
- data/config/locales/hu.yml +4 -1
- data/config/locales/hy.yml +4 -1
- data/config/locales/id.yml +4 -1
- data/config/locales/is.yml +4 -1
- data/config/locales/it.yml +4 -1
- data/config/locales/ja.yml +4 -1
- data/config/locales/ka.yml +4 -1
- data/config/locales/kk.yml +4 -1
- data/config/locales/ko.yml +4 -1
- data/config/locales/lt.yml +4 -1
- data/config/locales/lv.yml +4 -1
- data/config/locales/ms.yml +4 -1
- data/config/locales/mt.yml +4 -1
- data/config/locales/nl.yml +4 -1
- data/config/locales/no.yml +4 -1
- data/config/locales/pa-pk.yml +4 -1
- data/config/locales/pa.yml +4 -1
- data/config/locales/pl.yml +4 -1
- data/config/locales/ps.yml +4 -1
- data/config/locales/pt.yml +4 -1
- data/config/locales/ro.yml +4 -1
- data/config/locales/ru.yml +4 -1
- data/config/locales/si.yml +4 -1
- data/config/locales/sk.yml +4 -1
- data/config/locales/sl.yml +4 -1
- data/config/locales/so.yml +4 -1
- data/config/locales/sq.yml +4 -1
- data/config/locales/sr.yml +4 -1
- data/config/locales/sv.yml +4 -1
- data/config/locales/sw.yml +4 -1
- data/config/locales/ta.yml +4 -1
- data/config/locales/th.yml +4 -1
- data/config/locales/tk.yml +4 -1
- data/config/locales/tr.yml +4 -1
- data/config/locales/uk.yml +4 -1
- data/config/locales/ur.yml +4 -1
- data/config/locales/uz.yml +4 -1
- data/config/locales/vi.yml +4 -1
- data/config/locales/zh-hk.yml +4 -1
- data/config/locales/zh-tw.yml +4 -1
- data/config/locales/zh.yml +4 -1
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/axe-core/axe.d.ts +75 -24
- data/node_modules/axe-core/axe.js +4765 -4555
- data/node_modules/axe-core/axe.min.js +2 -2
- data/node_modules/axe-core/package.json +2 -2
- data/node_modules/axe-core/sri-history.json +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2070abba195716c8e72ea85dc7d7f207df27c52e497e808c8bc5d79c7b56b8af
|
4
|
+
data.tar.gz: f9978ff5d94c66b454978bc58346b8a76f7ff5408210695fd38372e4e5d29c20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c587c35eadec57a5515587e2064f5d55154cc9767a823015e4fb103bab8599bf367e2cfdbd5f58e65fd2612d690ba85b7760dd6535899ff5b90ad479b19a4ef9
|
7
|
+
data.tar.gz: c888b0e1e6ef2f1fde331e163009bd6f84077bb8011fcc799612af5d00d72f52cec00935f7cd71e347dd2d357f6c9e98ccc91a0c277b0bc4763ca9cdf4123591
|
@@ -11,34 +11,23 @@ window.GOVUK.analyticsGa4 = window.GOVUK.analyticsGa4 || {};
|
|
11
11
|
var newScript = document.createElement('script')
|
12
12
|
newScript.async = true
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
} else {
|
24
|
-
// initialise GTM
|
25
|
-
window.dataLayer = window.dataLayer || []
|
26
|
-
window.dataLayer.push({ 'gtm.blocklist': ['customPixels', 'customScripts', 'html', 'nonGoogleScripts'] })
|
27
|
-
window.dataLayer.push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' })
|
28
|
-
|
29
|
-
var auth = window.GOVUK.analyticsGa4.vars.auth || ''
|
30
|
-
var preview = window.GOVUK.analyticsGa4.vars.preview || ''
|
31
|
-
if (auth) {
|
32
|
-
auth = '>m_auth=' + auth
|
33
|
-
}
|
34
|
-
if (preview) {
|
35
|
-
preview = '>m_preview=' + preview + '>m_cookies_win=x'
|
36
|
-
}
|
37
|
-
|
38
|
-
this.googleSrc = 'https://www.googletagmanager.com/gtm.js?id=' + window.GOVUK.analyticsGa4.vars.id + auth + preview
|
39
|
-
newScript.src = this.googleSrc
|
40
|
-
firstScript.parentNode.insertBefore(newScript, firstScript)
|
14
|
+
// initialise GTM
|
15
|
+
window.dataLayer = window.dataLayer || []
|
16
|
+
window.dataLayer.push({ 'gtm.blocklist': ['customPixels', 'customScripts', 'html', 'nonGoogleScripts'] })
|
17
|
+
window.dataLayer.push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' })
|
18
|
+
|
19
|
+
var auth = window.GOVUK.analyticsGa4.vars.auth || ''
|
20
|
+
var preview = window.GOVUK.analyticsGa4.vars.preview || ''
|
21
|
+
if (auth) {
|
22
|
+
auth = '>m_auth=' + auth
|
41
23
|
}
|
24
|
+
if (preview) {
|
25
|
+
preview = '>m_preview=' + preview + '>m_cookies_win=x'
|
26
|
+
}
|
27
|
+
|
28
|
+
this.googleSrc = 'https://www.googletagmanager.com/gtm.js?id=' + window.GOVUK.analyticsGa4.vars.id + auth + preview
|
29
|
+
newScript.src = this.googleSrc
|
30
|
+
firstScript.parentNode.insertBefore(newScript, firstScript)
|
42
31
|
},
|
43
32
|
|
44
33
|
sendData: function (data) {
|
@@ -42,6 +42,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
42
42
|
return
|
43
43
|
}
|
44
44
|
|
45
|
+
var text = data.text || event.target.textContent
|
46
|
+
data.text = window.GOVUK.analyticsGa4.core.trackFunctions.removeLinesAndExtraSpaces(text)
|
45
47
|
schema.event = 'event_data'
|
46
48
|
// get attributes from the data attribute to send to GA
|
47
49
|
// only allow it if it already exists in the schema
|
@@ -28,11 +28,11 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
|
|
28
28
|
content_id: this.getMetaContent('content-id'),
|
29
29
|
|
30
30
|
browse_topic: this.getMetaContent('section'),
|
31
|
-
taxon_slug: this.getMetaContent('taxon-slug'),
|
32
|
-
taxon_id: this.getMetaContent('taxon-id'),
|
33
31
|
taxonomy_level1: this.getMetaContent('themes'),
|
34
|
-
|
35
|
-
|
32
|
+
taxonomy_main: this.getMetaContent('taxon-slug'),
|
33
|
+
taxonomy_main_id: this.getMetaContent('taxon-id'),
|
34
|
+
taxonomy_all: this.getMetaContent('taxon-slugs'),
|
35
|
+
taxonomy_all_ids: this.getMetaContent('taxon-ids'),
|
36
36
|
|
37
37
|
language: this.getLanguage(),
|
38
38
|
history: this.getHistory(),
|
data/app/assets/javascripts/govuk_publishing_components/components/layout-super-navigation-header.js
CHANGED
@@ -92,32 +92,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
92
92
|
return closestPrevious(previousElement, elementType)
|
93
93
|
}
|
94
94
|
|
95
|
-
// When moving from one screen size to another (eg mobile to desktop) we need
|
96
|
-
// to find out whether a submenu is open so the parent menu can be kept open.
|
97
|
-
var hasSubMenusOpen = function ($menu) {
|
98
|
-
return $menu.querySelectorAll('button[aria-expanded="true"]').length > 0
|
99
|
-
}
|
100
|
-
|
101
|
-
// Detect the current viewport width. Return the string `desktop` or `mobile` so it can be interpolated to access the
|
102
|
-
// `data-toggle-{desktop|mobile}-group` attribute.
|
103
|
-
//
|
104
|
-
// Use `matchedia` which mitigates issues in modern browsers when scrollbars are forced in MacOS (using `document.documentElement.clientWidth`
|
105
|
-
// for viewport width detection has issues in Chrome and Firefox, and `window.innerWidth` has issues in Safari).
|
106
|
-
//
|
107
|
-
// Fall back to `document.documentElement.clientWidth` for legacy browsers.
|
108
|
-
var windowSize = function () {
|
109
|
-
var viewport = false
|
110
|
-
if (typeof window.matchMedia === 'function') {
|
111
|
-
viewport = window.matchMedia('(min-width:' + SETTINGS.breakpoint.desktop + 'px)').matches
|
112
|
-
} else {
|
113
|
-
viewport = document.documentElement.clientWidth >= SETTINGS.breakpoint.desktop
|
114
|
-
}
|
115
|
-
return viewport ? 'desktop' : 'mobile'
|
116
|
-
}
|
117
95
|
function SuperNavigationMegaMenu ($module) {
|
118
96
|
this.$module = $module
|
119
|
-
this.$navigationToggle = this.$module.querySelector('#super-navigation-menu-toggle')
|
120
|
-
this.$navigationMenu = this.$module.querySelector('#super-navigation-menu')
|
121
97
|
this.$searchToggle = this.$module.querySelector('#super-search-menu-toggle')
|
122
98
|
this.$searchMenu = this.$module.querySelector('#super-search-menu')
|
123
99
|
|
@@ -132,55 +108,25 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
132
108
|
)
|
133
109
|
|
134
110
|
this.hiddenButtons = this.$module.querySelectorAll('button[hidden]')
|
135
|
-
|
136
|
-
this.lastWindowSize = null
|
137
111
|
}
|
138
112
|
|
139
|
-
SuperNavigationMegaMenu.prototype.windowSize = windowSize
|
140
|
-
|
141
113
|
SuperNavigationMegaMenu.prototype.updateStates = function () {
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
this.$module.style.marginBottom = '0'
|
153
|
-
}
|
154
|
-
|
155
|
-
// Hide the navigation toggle button and show the navigation submenu:
|
156
|
-
if (this.windowSize() === 'desktop' && this.lastWindowSize !== 'desktop') {
|
157
|
-
this.$navigationToggle.setAttribute('hidden', 'hidden')
|
158
|
-
this.$navigationMenu.removeAttribute('hidden')
|
159
|
-
}
|
160
|
-
|
161
|
-
// The dropdown menu height is only needed when in desktop mode as this is
|
162
|
-
// when the dropdown menu is using `absolute` positioning. This requires
|
163
|
-
// JavaScript to work out the height and make space for the dropdown menu.
|
164
|
-
if (windowSize() === 'desktop') {
|
165
|
-
// Check whether any of the dropdown menus are open.
|
166
|
-
var $openButton = this.$module.querySelector('[aria-expanded="true"][data-toggle-desktop-group="top"]')
|
167
|
-
// Gets the open dropdown menu
|
168
|
-
var $openMenu = $openButton ? this.$module.querySelector('#' + $openButton.getAttribute('aria-controls')) : null
|
169
|
-
// If there is an open dropdown menu, get the height of the dropdown menu.
|
170
|
-
var margin = $openMenu ? $openMenu.offsetHeight : 0
|
171
|
-
|
172
|
-
// Make space for the dropdown menu.
|
173
|
-
this.$module.style.marginBottom = margin + 'px'
|
174
|
-
}
|
175
|
-
|
176
|
-
this.lastWindowSize = this.windowSize()
|
114
|
+
// Check whether any of the dropdown menus are open.
|
115
|
+
var $openButton = this.$module.querySelector('[aria-expanded="true"][data-toggle-desktop-group="top"]')
|
116
|
+
// Gets the open dropdown menu
|
117
|
+
var $openMenu = $openButton ? this.$module.querySelector('#' + $openButton.getAttribute('aria-controls')) : null
|
118
|
+
// If there is an open dropdown menu, get the height of the dropdown menu.
|
119
|
+
var margin = $openMenu ? $openMenu.offsetHeight : 0
|
120
|
+
|
121
|
+
// Make space for the dropdown menu.
|
122
|
+
this.$module.style.marginBottom = margin + 'px'
|
177
123
|
}
|
178
124
|
|
179
125
|
SuperNavigationMegaMenu.prototype.buttonHandler = function (event) {
|
180
126
|
var $target = closestParentIncluding(event.target, 'button')
|
181
127
|
var $targetMenu = this.$module.querySelector('#' + $target.getAttribute('aria-controls'))
|
182
128
|
|
183
|
-
var toggleGroupAttribute = 'data-toggle-
|
129
|
+
var toggleGroupAttribute = 'data-toggle-desktop-group'
|
184
130
|
var toggleGroupName = $target.getAttribute(toggleGroupAttribute)
|
185
131
|
var toggleGroupList = this.$module.querySelectorAll('[' + toggleGroupAttribute + '="' + toggleGroupName + '"]')
|
186
132
|
|
@@ -194,9 +140,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
194
140
|
|
195
141
|
toggle($target, $targetMenu)
|
196
142
|
|
197
|
-
|
198
|
-
this.$module.style.marginBottom = $targetMenu.offsetHeight + 'px'
|
199
|
-
}
|
143
|
+
this.$module.style.marginBottom = $targetMenu.offsetHeight + 'px'
|
200
144
|
}
|
201
145
|
|
202
146
|
SuperNavigationMegaMenu.prototype.init = function () {
|
@@ -217,6 +161,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
217
161
|
$element.removeAttribute('hidden')
|
218
162
|
|
219
163
|
var closestSiblingLink = closestPrevious($element, 'a')
|
164
|
+
|
220
165
|
if (closestSiblingLink) {
|
221
166
|
closestSiblingLink.setAttribute('hidden', 'hidden')
|
222
167
|
}
|
@@ -237,8 +182,6 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
237
182
|
hide(this.$searchToggle, this.$searchMenu)
|
238
183
|
this.updateStates()
|
239
184
|
|
240
|
-
this.lastWindowSize = this.windowSize()
|
241
|
-
|
242
185
|
// The menu needs to be updated when the window is resized to make sure that
|
243
186
|
// the space needed for the dropdown menu is correct.
|
244
187
|
window.addEventListener('resize', this.updateStates.bind(this), { passive: true })
|
@@ -178,30 +178,31 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
178
178
|
var title = thisel.querySelectorAll('.js-step-title')[0]
|
179
179
|
var contentId = thisel.querySelectorAll('.js-panel')[0].getAttribute('id')
|
180
180
|
var titleText = title.textContent || title.innerText // IE8 fallback
|
181
|
-
var ga4Data = ''
|
182
|
-
|
183
|
-
if (this.$module.isGa4Enabled) {
|
184
|
-
var ga4JSON = {
|
185
|
-
event_name: 'select_content',
|
186
|
-
type: 'step by step',
|
187
|
-
text: titleText.trim(),
|
188
|
-
index: i + 1,
|
189
|
-
index_total: this.$module.totalSteps
|
190
|
-
}
|
191
|
-
ga4Data = "data-ga4-event='" + JSON.stringify(ga4JSON) + "'" // Construct GA4 data-attributes for ga4-event-tracker.
|
192
|
-
}
|
193
181
|
|
194
182
|
title.outerHTML =
|
195
183
|
'<span class="js-step-title">' +
|
196
184
|
'<button ' +
|
197
185
|
'class="gem-c-step-nav__button gem-c-step-nav__button--title js-step-title-button" ' +
|
198
|
-
'aria-expanded="false" aria-controls="' + contentId + '"
|
186
|
+
'aria-expanded="false" aria-controls="' + contentId + '"' + '>' +
|
199
187
|
'<span class="gem-c-step-nav____title-text-focus">' +
|
200
188
|
'<span class="gem-c-step-nav__title-text js-step-title-text">' + titleText + '</span>' +
|
201
189
|
'<span class="govuk-visually-hidden gem-c-step-nav__section-heading-divider">, </span>' +
|
202
190
|
'</span>' +
|
203
191
|
'</button>' +
|
204
192
|
'</span>'
|
193
|
+
|
194
|
+
if (this.$module.isGa4Enabled) {
|
195
|
+
var ga4JSON = {
|
196
|
+
event_name: 'select_content',
|
197
|
+
type: 'step by step',
|
198
|
+
text: titleText.trim(),
|
199
|
+
index: i + 1,
|
200
|
+
index_total: this.$module.totalSteps
|
201
|
+
}
|
202
|
+
|
203
|
+
var button = thisel.querySelector('.js-step-title-button')
|
204
|
+
button.setAttribute('data-ga4-event', JSON.stringify(ga4JSON))
|
205
|
+
}
|
205
206
|
}
|
206
207
|
}
|
207
208
|
|