govuk_publishing_components 31.2.0 → 32.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/images/govuk_publishing_components/action-link-arrow--blue.svg +8 -2
- data/app/assets/javascripts/govuk_publishing_components/analytics/track-click.js +1 -1
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-ecommerce-tracker.js +10 -5
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-event-tracker.js +2 -2
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-page-views.js +10 -3
- data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +25 -1
- data/app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb +19 -12
- data/app/views/govuk_publishing_components/components/feedback/_survey_signup_form.html.erb +10 -2
- data/app/views/govuk_publishing_components/components/feedback/_yes_no_banner.html.erb +1 -2
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/axe-core/README.md +7 -6
- data/node_modules/axe-core/axe.d.ts +1 -0
- data/node_modules/axe-core/axe.js +8911 -7204
- data/node_modules/axe-core/axe.min.js +2 -2
- data/node_modules/axe-core/locales/_template.json +1067 -0
- data/node_modules/axe-core/locales/fr.json +1 -1
- data/node_modules/axe-core/locales/he.json +1015 -0
- data/node_modules/axe-core/locales/no_NB.json +797 -0
- data/node_modules/axe-core/package.json +57 -59
- data/node_modules/axe-core/sri-history.json +4 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40c8f5cd0a641b265004d0db4aa4dad79cc1f251bc6510655d69bc7fa954614f
|
4
|
+
data.tar.gz: 80b737085d4e49d8a2d5558472f918ed7632db5932d32c9945ad82d936c3a2d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c18a6aee8070978fd4f72f29eb7d916d8899a261c3bac0fac075703a18d5c7e7b1854fc56dc3d9ee4bfae10e1c5725aa4693f0488edac5429bb5f9b6ceed3e33
|
7
|
+
data.tar.gz: 2903283d75f095a49ebd6940cb003bc6653bf3e2e96cd990f311b3b113b1925bf042b9bc689a0f01d1f951973aee8f58fd00945e771507477e1ec69fa29eca1b
|
@@ -1,3 +1,9 @@
|
|
1
|
-
<svg width="
|
2
|
-
<
|
1
|
+
<svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<circle cx="19.5" cy="19.5" r="19.5" fill="#366FB3" mask="url(#mask)"/>
|
3
|
+
|
4
|
+
<mask id="mask">
|
5
|
+
<rect width="100%" height="100%" fill="white"/>
|
6
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.0343 20L14.1812 10.1469L17.0096 7.31848L29.6912 20L17.0096 32.6815L14.1812 29.8531L24.0343 20Z" fill="black"/>
|
7
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M0.000423781 18L25.1328 18L25.1328 22L0.000423431 22L0.000423781 18Z" fill="black"/>
|
8
|
+
</mask>
|
3
9
|
</svg>
|
@@ -19,7 +19,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
19
19
|
var target = e.target
|
20
20
|
if (!trackLinksOnly) {
|
21
21
|
that.$module.handleClick(target)
|
22
|
-
} else if (trackLinksOnly && target.
|
22
|
+
} else if (trackLinksOnly && target.closest('a')) {
|
23
23
|
if (!limitToElementClass) {
|
24
24
|
that.$module.handleClick(target)
|
25
25
|
} else if (limitToElementClass && target.closest('.' + limitToElementClass)) {
|
data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-ecommerce-tracker.js
CHANGED
@@ -9,12 +9,17 @@
|
|
9
9
|
PIIRemover: new GOVUK.analyticsGa4.PIIRemover(),
|
10
10
|
DEFAULT_LIST_TITLE: 'Site search results',
|
11
11
|
|
12
|
-
init: function (
|
12
|
+
init: function (referrer) {
|
13
13
|
if (window.dataLayer) {
|
14
|
+
/* The referrer parameter is only passed to the init() function as a result of an AJAX request
|
15
|
+
(in live_search.js in the finder-frontend repository). Otherwise it will not be available and this indicates a fresh page load.
|
16
|
+
This is needed to trigger a fresh pageViewTracker push to the dataLayer on dynamic page updates and to prevent multiple
|
17
|
+
click listeners from being applied on this.searchResultsBlocks elements. */
|
18
|
+
var isNewPageLoad = !referrer
|
19
|
+
|
14
20
|
/* The data-ga4-ecommerce attribute may be present on several DOM elements e.g. search results and spelling
|
15
21
|
suggestions, hence why document.querySelectorAll is required */
|
16
22
|
this.searchResultsBlocks = document.querySelectorAll('[data-ga4-ecommerce]')
|
17
|
-
this.isNewPageLoad = isNewPageLoad
|
18
23
|
|
19
24
|
if (!this.searchResultsBlocks.length === 0) {
|
20
25
|
return
|
@@ -23,18 +28,18 @@
|
|
23
28
|
/* If the results are updated by JS, the URL of the page will change and this needs to be visible to PA's,
|
24
29
|
hence the pageView object push to the dataLayer. We do not need to send a pageView object on page load as
|
25
30
|
this is handled elsewhere. */
|
26
|
-
if (
|
31
|
+
if (referrer) {
|
27
32
|
var pageViewTracker = window.GOVUK.analyticsGa4.analyticsModules.PageViewTracker
|
28
33
|
|
29
34
|
if (pageViewTracker) {
|
30
|
-
pageViewTracker.init()
|
35
|
+
pageViewTracker.init(referrer)
|
31
36
|
}
|
32
37
|
}
|
33
38
|
|
34
39
|
for (var i = 0; i < this.searchResultsBlocks.length; i++) {
|
35
40
|
this.trackSearchResults(this.searchResultsBlocks[i])
|
36
41
|
|
37
|
-
if (
|
42
|
+
if (isNewPageLoad) {
|
38
43
|
this.searchResultsBlocks[i].addEventListener('click', this.handleClick.bind(this))
|
39
44
|
}
|
40
45
|
}
|
@@ -51,8 +51,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
51
51
|
}
|
52
52
|
}
|
53
53
|
|
54
|
-
|
55
|
-
if (target.closest('.gem-c-accordion')) {
|
54
|
+
/* Ensure it only tracks aria-expanded in an accordion or element with data-ga4-expandable on it. */
|
55
|
+
if (target.closest('.gem-c-accordion') || target.closest('[data-ga4-expandable]')) {
|
56
56
|
var ariaExpanded = this.getClosestAttribute(target, 'aria-expanded')
|
57
57
|
}
|
58
58
|
|
@@ -9,13 +9,15 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
|
|
9
9
|
PIIRemover: new window.GOVUK.analyticsGa4.PIIRemover(), // imported in analytics-ga4.js
|
10
10
|
nullValue: undefined,
|
11
11
|
|
12
|
-
init: function () {
|
12
|
+
init: function (referrer) {
|
13
13
|
if (window.dataLayer) {
|
14
14
|
var data = {
|
15
15
|
event: 'page_view',
|
16
16
|
page_view: {
|
17
17
|
location: this.getLocation(),
|
18
|
-
|
18
|
+
/* If the init() function receives a referrer parameter, this indicates that it has been called as a part of an AJAX request and
|
19
|
+
this.getReferrer() will not return the correct value. Therefore we need to rely on the referrer parameter. */
|
20
|
+
referrer: referrer || this.getReferrer(),
|
19
21
|
title: this.getTitle(),
|
20
22
|
status_code: this.getStatusCode(),
|
21
23
|
|
@@ -42,7 +44,12 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
|
|
42
44
|
political_status: this.getMetaContent('political-status'),
|
43
45
|
primary_publishing_organisation: this.getMetaContent('primary-publishing-organisation'),
|
44
46
|
organisations: this.getMetaContent('analytics:organisations'),
|
45
|
-
world_locations: this.getMetaContent('analytics:world-locations')
|
47
|
+
world_locations: this.getMetaContent('analytics:world-locations'),
|
48
|
+
|
49
|
+
/* The existence of a referrer parameter indicates that the page has been dynamically updated via an AJAX request
|
50
|
+
and therefore we can use it to set the dynamic property appropriately. This value is used by PA's to differentiate
|
51
|
+
between fresh page loads and dynamic page updates. */
|
52
|
+
dynamic: referrer ? 'true' : 'false'
|
46
53
|
}
|
47
54
|
}
|
48
55
|
window.GOVUK.analyticsGa4.core.sendData(data)
|
data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
hide_navigation_menu_text = t("components.layout_super_navigation_header.menu_toggle_label.hide", :label => "navigation")
|
16
16
|
show_navigation_menu_text = t("components.layout_super_navigation_header.menu_toggle_label.show", :label => "navigation")
|
17
17
|
%>
|
18
|
-
<header role="banner" class="gem-c-layout-super-navigation-header" data-module="gem-track-click" data-track-links-only>
|
18
|
+
<header role="banner" class="gem-c-layout-super-navigation-header" data-module="gem-track-click ga4-event-tracker" data-track-links-only data-ga4-expandable>
|
19
19
|
<div class="gem-c-layout-super-navigation-header__container govuk-width-container govuk-clearfix">
|
20
20
|
<div class="gem-c-layout-super-navigation-header__header-logo">
|
21
21
|
<a
|
@@ -78,6 +78,14 @@
|
|
78
78
|
hidden
|
79
79
|
id="super-navigation-menu-toggle"
|
80
80
|
type="button"
|
81
|
+
data-ga4="<%= {
|
82
|
+
"event_name": "select_content",
|
83
|
+
"type": "header menu bar",
|
84
|
+
"text": "Menu",
|
85
|
+
"index": 1,
|
86
|
+
"index_total": navigation_links.length + 2,
|
87
|
+
"section": "Menu"
|
88
|
+
}.to_json %>"
|
81
89
|
>
|
82
90
|
<span class="gem-c-layout-super-navigation-header__navigation-top-toggle-button-inner">
|
83
91
|
Menu
|
@@ -124,6 +132,14 @@
|
|
124
132
|
toggle_desktop_group: "top",
|
125
133
|
toggle_mobile_group: "second",
|
126
134
|
tracking_key: tracking_label,
|
135
|
+
ga4: {
|
136
|
+
event_name: "select_content",
|
137
|
+
type: "header menu bar",
|
138
|
+
text: link[:label],
|
139
|
+
index: index + 2,
|
140
|
+
index_total: navigation_links.length + 2,
|
141
|
+
section: link[:label]
|
142
|
+
}
|
127
143
|
},
|
128
144
|
hidden: true,
|
129
145
|
id: "super-navigation-menu__section-#{unique_id}-toggle",
|
@@ -217,6 +233,14 @@
|
|
217
233
|
hidden
|
218
234
|
id="super-search-menu-toggle"
|
219
235
|
type="button"
|
236
|
+
data-ga4="<%= {
|
237
|
+
"event_name": "select_content",
|
238
|
+
"type": "header menu bar",
|
239
|
+
"text": "Search",
|
240
|
+
"index": navigation_links.length + 2,
|
241
|
+
"index_total": navigation_links.length + 2,
|
242
|
+
"section": "Search"
|
243
|
+
}.to_json %>"
|
220
244
|
>
|
221
245
|
<span class="govuk-visually-hidden">
|
222
246
|
<%= search_text %>
|
@@ -39,25 +39,32 @@
|
|
39
39
|
} %>
|
40
40
|
|
41
41
|
<%= render "govuk_publishing_components/components/button", {
|
42
|
-
text: t("components.feedback.send")
|
42
|
+
text: t("components.feedback.send"),
|
43
|
+
data_attributes: {
|
44
|
+
ga4: {
|
45
|
+
event_name: "form_submit",
|
46
|
+
type: "feedback",
|
47
|
+
text: "Send",
|
48
|
+
section: "Help us improve GOV.UK",
|
49
|
+
}
|
50
|
+
}
|
43
51
|
} %>
|
44
52
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
53
|
+
<button
|
54
|
+
class="govuk-button govuk-button--secondary gem-c-feedback__close gem-c-feedback__js-show js-close-form"
|
55
|
+
data-track-category="Onsite Feedback"
|
56
|
+
data-track-action="GOV.UK Close Form"
|
57
|
+
aria-controls="something-is-wrong"
|
58
|
+
aria-expanded="true">
|
59
|
+
<%= t("components.feedback.close") %>
|
60
|
+
</button>
|
54
61
|
</div>
|
55
62
|
</div>
|
56
63
|
</form>
|
57
64
|
|
58
65
|
<%
|
59
|
-
# I've added the following script inline in case of a scenario where a bot is able to parse the page,
|
60
|
-
# without downloading any of the external scripts.
|
66
|
+
# I've added the following script inline in case of a scenario where a bot is able to parse the page,
|
67
|
+
# without downloading any of the external scripts.
|
61
68
|
# This seems to be a more reliable way to make sure the script is executed.
|
62
69
|
%>
|
63
70
|
|
@@ -25,8 +25,16 @@
|
|
25
25
|
describedby: "survey_explanation"
|
26
26
|
} %>
|
27
27
|
|
28
|
-
|
28
|
+
<%= render "govuk_publishing_components/components/button", {
|
29
29
|
text: t("components.feedback.send_me_survey"),
|
30
|
+
data_attributes: {
|
31
|
+
ga4: {
|
32
|
+
event_name: "form_submit",
|
33
|
+
type: "feedback",
|
34
|
+
text: "Send me the survey",
|
35
|
+
section: "Help us improve GOV.UK",
|
36
|
+
}
|
37
|
+
}
|
30
38
|
} %>
|
31
39
|
|
32
40
|
<button
|
@@ -38,7 +46,7 @@
|
|
38
46
|
hidden>
|
39
47
|
<%= t("components.feedback.close") %>
|
40
48
|
</button>
|
41
|
-
|
49
|
+
|
42
50
|
</div>
|
43
51
|
</div>
|
44
52
|
</form>
|
@@ -39,10 +39,9 @@
|
|
39
39
|
</div>
|
40
40
|
|
41
41
|
<div class="gem-c-feedback__prompt-questions gem-c-feedback__prompt-questions--something-is-wrong js-prompt-questions" hidden>
|
42
|
-
<button class="govuk-button gem-c-feedback__prompt-link js-toggle-form js-something-is-wrong" data-track-category="Onsite Feedback" data-track-action="GOV-UK Open Form" aria-controls="something-is-wrong" aria-expanded="false">
|
42
|
+
<button class="govuk-button gem-c-feedback__prompt-link js-toggle-form js-something-is-wrong" data-track-category="Onsite Feedback" data-track-action="GOV-UK Open Form" aria-controls="something-is-wrong" aria-expanded="false" data-ga4='{"event_name":"form_submit","type":"feedback","text":"Report a problem with this page", "section": "Is this page useful?"}'>
|
43
43
|
<%= t("components.feedback.something_wrong") %>
|
44
44
|
</button>
|
45
45
|
</div>
|
46
|
-
|
47
46
|
</div>
|
48
47
|
</div>
|
@@ -78,9 +78,9 @@ The [axe-core API](doc/API.md) fully supports the following browsers:
|
|
78
78
|
- Google Chrome v42 and above
|
79
79
|
- Mozilla Firefox v38 and above
|
80
80
|
- Apple Safari v7 and above
|
81
|
-
- Internet Explorer v11
|
81
|
+
- Internet Explorer v11 (DEPRECATED)
|
82
82
|
|
83
|
-
Support means that we will fix bugs and attempt to test each browser regularly. Only
|
83
|
+
Support means that we will fix bugs and attempt to test each browser regularly. Only Chrome and Firefox are currently tested on every pull request.
|
84
84
|
|
85
85
|
There is limited support for JSDOM. We will attempt to make all rules compatible with JSDOM but where this is not possible, we recommend turning those rules off. Currently the `color-contrast` rule is known not to work with JSDOM.
|
86
86
|
|
@@ -103,9 +103,9 @@ or equivalently:
|
|
103
103
|
|
104
104
|
`npm run build -- --lang=nl`
|
105
105
|
|
106
|
-
This will create a new build for axe, called `axe.<lang>.js` and `axe.<lang>.min.js`. If you want to build localized versions, simply pass in `--all-lang` instead. If you want to build multiple localized versions (but not all of them), you can pass in a comma-separated list of
|
106
|
+
This will create a new build for axe, called `axe.<lang>.js` and `axe.<lang>.min.js`. If you want to build localized versions, simply pass in `--all-lang` instead. If you want to build multiple localized versions (but not all of them), you can pass in a comma-separated list of languages to the `--lang` flag, like `--lang=nl,ja`.
|
107
107
|
|
108
|
-
To create a new translation for axe, start by running `grunt translate --lang=<langcode>`. This will create a json file fin the `./locales` directory, with the default English text in it for you to translate. We welcome any localization for axe-core. For details on how to contribute, see the Contributing section below. For details on the message syntax, see [Check Message Template](/docs/check-message-template.md).
|
108
|
+
To create a new translation for axe, start by running `grunt translate --lang=<langcode>`. This will create a json file fin the `./locales` directory, with the default English text in it for you to translate. Alternatively, you could copy `./locales/_template.json`. We welcome any localization for axe-core. For details on how to contribute, see the Contributing section below. For details on the message syntax, see [Check Message Template](/docs/check-message-template.md).
|
109
109
|
|
110
110
|
To update existing translation file, re-run `grunt translate --lang=<langcode>`. This will add new messages used in English and remove messages which were not used in English.
|
111
111
|
|
@@ -127,8 +127,7 @@ axe.configure({
|
|
127
127
|
},
|
128
128
|
'aria-errormessage': {
|
129
129
|
// Note: doT (https://github.com/olado/dot) templates are supported here.
|
130
|
-
fail:
|
131
|
-
'Der Wert der aria-errormessage ${data.values}` muss eine Technik verwenden, um die Message anzukündigen (z. B., aria-live, aria-describedby, role=alert, etc.).'
|
130
|
+
fail: 'Der Wert der aria-errormessage ${data.values}` muss eine Technik verwenden, um die Message anzukündigen (z. B., aria-live, aria-describedby, role=alert, etc.).'
|
132
131
|
}
|
133
132
|
// ...
|
134
133
|
}
|
@@ -145,8 +144,10 @@ Axe-core supports the following locales. Do note that since locales are contribu
|
|
145
144
|
- Dutch
|
146
145
|
- French
|
147
146
|
- German
|
147
|
+
- Hebrew
|
148
148
|
- Japanese
|
149
149
|
- Korean
|
150
|
+
- Norwegian (Bokmål)
|
150
151
|
- Polish
|
151
152
|
- Portuguese (Brazilian)
|
152
153
|
- Spanish
|