govuk_publishing_components 44.9.0 → 44.10.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-search-tracker.js +73 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4.js +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_chart.scss +15 -0
- data/app/views/govuk_publishing_components/components/_chart.html.erb +15 -1
- data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +7 -12
- data/app/views/govuk_publishing_components/components/docs/chart.yml +1 -0
- data/config/locales/ar.yml +2 -0
- data/config/locales/az.yml +2 -0
- data/config/locales/be.yml +2 -0
- data/config/locales/bg.yml +2 -0
- data/config/locales/bn.yml +2 -0
- data/config/locales/cs.yml +2 -0
- data/config/locales/cy.yml +2 -0
- data/config/locales/da.yml +2 -0
- data/config/locales/de.yml +2 -0
- data/config/locales/dr.yml +2 -0
- data/config/locales/el.yml +2 -0
- data/config/locales/en.yml +3 -1
- data/config/locales/es-419.yml +2 -0
- data/config/locales/es.yml +2 -0
- data/config/locales/et.yml +2 -0
- data/config/locales/fa.yml +2 -0
- data/config/locales/fi.yml +2 -0
- data/config/locales/fr.yml +2 -0
- data/config/locales/gd.yml +2 -0
- data/config/locales/gu.yml +2 -0
- data/config/locales/he.yml +2 -0
- data/config/locales/hi.yml +2 -0
- data/config/locales/hr.yml +2 -0
- data/config/locales/hu.yml +2 -0
- data/config/locales/hy.yml +2 -0
- data/config/locales/id.yml +2 -0
- data/config/locales/is.yml +2 -0
- data/config/locales/it.yml +2 -0
- data/config/locales/ja.yml +2 -0
- data/config/locales/ka.yml +2 -0
- data/config/locales/kk.yml +2 -0
- data/config/locales/ko.yml +2 -0
- data/config/locales/lt.yml +2 -0
- data/config/locales/lv.yml +2 -0
- data/config/locales/ms.yml +2 -0
- data/config/locales/mt.yml +2 -0
- data/config/locales/nl.yml +2 -0
- data/config/locales/no.yml +2 -0
- data/config/locales/pa-pk.yml +2 -0
- data/config/locales/pa.yml +2 -0
- data/config/locales/pl.yml +2 -0
- data/config/locales/ps.yml +2 -0
- data/config/locales/pt.yml +2 -0
- data/config/locales/ro.yml +2 -0
- data/config/locales/ru.yml +2 -0
- data/config/locales/si.yml +2 -0
- data/config/locales/sk.yml +2 -0
- data/config/locales/sl.yml +2 -0
- data/config/locales/so.yml +2 -0
- data/config/locales/sq.yml +2 -0
- data/config/locales/sr.yml +2 -0
- data/config/locales/sv.yml +2 -0
- data/config/locales/sw.yml +2 -0
- data/config/locales/ta.yml +2 -0
- data/config/locales/th.yml +2 -0
- data/config/locales/tk.yml +2 -0
- data/config/locales/tr.yml +2 -0
- data/config/locales/uk.yml +2 -0
- data/config/locales/ur.yml +2 -0
- data/config/locales/uz.yml +2 -0
- data/config/locales/vi.yml +2 -0
- data/config/locales/zh-hk.yml +2 -0
- data/config/locales/zh-tw.yml +2 -0
- data/config/locales/zh.yml +2 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2969bc9c245ca82ad65122c89ba86180242c253448759078c253874a97255ddc
|
4
|
+
data.tar.gz: 282f3aa5d64dd2aa69d3523419affa8a1bc81a770a78c3a8c8c6873d616109e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d86fad3ae81196d495d5b09454f4a1577b96020b97eda59283a7a052cd0c97152574b7c41fb80844c3bd8543d6074a3d67cfd3efd84f6f6de71921757f308c38
|
7
|
+
data.tar.gz: 199cec0448a12f946ad21baba218e341f139da3e94add2d64ad2d9b0de5b1d07861d0d96e6dadc76315cd070c654fe0cec7427109a237d997153cbefbe5ed6f4
|
@@ -0,0 +1,73 @@
|
|
1
|
+
window.GOVUK = window.GOVUK || {}
|
2
|
+
window.GOVUK.Modules = window.GOVUK.Modules || {};
|
3
|
+
(function (Modules) {
|
4
|
+
'use strict'
|
5
|
+
// Tracks interactions with search forms, including on the all content finder ("site search"),
|
6
|
+
// homepage, and the layout super navigation header search.
|
7
|
+
class Ga4SearchTracker {
|
8
|
+
constructor ($module) {
|
9
|
+
this.$module = $module
|
10
|
+
this.$searchInput = this.$module.querySelector('input[type="search"]')
|
11
|
+
|
12
|
+
this.type = this.$module.dataset.ga4SearchType
|
13
|
+
this.url = this.$module.dataset.ga4SearchUrl
|
14
|
+
this.section = this.$module.dataset.ga4SearchSection
|
15
|
+
this.indexSection = this.$module.dataset.ga4SearchIndexSection
|
16
|
+
this.indexSectionCount = this.$module.dataset.ga4SearchIndexSectionCount
|
17
|
+
}
|
18
|
+
|
19
|
+
init () {
|
20
|
+
if (!this.$searchInput) {
|
21
|
+
console.warn('Ga4SearchTracker: Module added to element without child search input')
|
22
|
+
return
|
23
|
+
}
|
24
|
+
|
25
|
+
this.initialKeywords = this.$searchInput.value
|
26
|
+
|
27
|
+
if (window.GOVUK.getConsentCookie() && window.GOVUK.getConsentCookie().usage) {
|
28
|
+
this.startModule()
|
29
|
+
} else {
|
30
|
+
window.addEventListener('cookie-consent', () => this.startModule())
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
startModule () {
|
35
|
+
this.$module.addEventListener('submit', event => this.trackSearch(event))
|
36
|
+
}
|
37
|
+
|
38
|
+
trackSearch () {
|
39
|
+
if (this.skipTracking()) return
|
40
|
+
|
41
|
+
const data = {
|
42
|
+
event_name: 'search',
|
43
|
+
action: 'search',
|
44
|
+
|
45
|
+
type: this.type,
|
46
|
+
section: this.section,
|
47
|
+
url: this.url,
|
48
|
+
index_section: this.indexSection,
|
49
|
+
index_section_count: this.indexSectionCount,
|
50
|
+
text: this.searchTerm()
|
51
|
+
}
|
52
|
+
|
53
|
+
window.GOVUK.analyticsGa4.core.applySchemaAndSendData(data, 'event_data')
|
54
|
+
}
|
55
|
+
|
56
|
+
skipTracking () {
|
57
|
+
// Skip tracking for those events that we do not want to track: where the search term is
|
58
|
+
// present, but has not changed from its initial value
|
59
|
+
return this.searchTerm() !== '' && this.searchTerm() === this.initialKeywords
|
60
|
+
}
|
61
|
+
|
62
|
+
searchTerm () {
|
63
|
+
const { standardiseSearchTerm } = window.GOVUK.analyticsGa4.core.trackFunctions
|
64
|
+
|
65
|
+
// `standardiseSearchTerm` returns undefined for empty strings, whereas we actively want an
|
66
|
+
// empty string as part of search events (undefined would not overwrite the current value in
|
67
|
+
// the analytics state)
|
68
|
+
return standardiseSearchTerm(this.$searchInput.value) || ''
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
Modules.Ga4SearchTracker = Ga4SearchTracker
|
73
|
+
})(window.GOVUK.Modules)
|
@@ -13,6 +13,7 @@
|
|
13
13
|
//= require ./analytics-ga4/ga4-auto-tracker
|
14
14
|
//= require ./analytics-ga4/ga4-smart-answer-results-tracker
|
15
15
|
//= require ./analytics-ga4/ga4-scroll-tracker
|
16
|
+
//= require ./analytics-ga4/ga4-search-tracker
|
16
17
|
//= require ./analytics-ga4/ga4-video-tracker
|
17
18
|
//= require ./analytics-ga4/ga4-focus-loss-tracker
|
18
19
|
//= require ./analytics-ga4/init-ga4
|
@@ -47,3 +47,18 @@
|
|
47
47
|
padding: 0 govuk-spacing(4);
|
48
48
|
}
|
49
49
|
}
|
50
|
+
|
51
|
+
.gem-c-chart .gem-c-chart__a11y-note-link {
|
52
|
+
display: none;
|
53
|
+
margin-bottom: govuk-spacing(2);
|
54
|
+
}
|
55
|
+
|
56
|
+
.js-enabled {
|
57
|
+
.gem-c-chart .gem-c-chart__a11y-note-link {
|
58
|
+
display: inline;
|
59
|
+
}
|
60
|
+
|
61
|
+
.gem-c-chart .gem-c-chart__a11y-note-link:focus-within {
|
62
|
+
display: inline-block;
|
63
|
+
}
|
64
|
+
}
|
@@ -3,6 +3,7 @@
|
|
3
3
|
add_gem_component_stylesheet("table")
|
4
4
|
add_gem_component_stylesheet("details")
|
5
5
|
add_gem_component_stylesheet("heading")
|
6
|
+
add_gem_component_stylesheet("skip-link")
|
6
7
|
|
7
8
|
chart_heading ||= nil
|
8
9
|
chart_heading_level ||= 2
|
@@ -44,6 +45,10 @@
|
|
44
45
|
textPosition = nil
|
45
46
|
textPosition = 'none' if minimal
|
46
47
|
|
48
|
+
if !minimal && !chart_heading
|
49
|
+
raise ArgumentError, "A chart heading must be provided for accessibility purposes."
|
50
|
+
end
|
51
|
+
|
47
52
|
chart_library_options = {
|
48
53
|
chartArea: { width: '80%', height: '60%' },
|
49
54
|
crosshair: { orientation: 'vertical', trigger: 'both', color: '#ccc' },
|
@@ -97,8 +102,14 @@
|
|
97
102
|
<% unless minimal %>
|
98
103
|
<div class="govuk-visually-hidden">
|
99
104
|
<%= content_tag :div, chart_overview, class: "gem-c-chart__a11y-note-1" if chart_overview %>
|
100
|
-
<%= content_tag :div, t("components.chart.accessibility_html"
|
105
|
+
<%= content_tag :div, t("components.chart.accessibility_html"), class: "gem-c-chart__a11y-note-2" %>
|
101
106
|
</div>
|
107
|
+
<span class="gem-c-chart__a11y-note-link">
|
108
|
+
<%= render "govuk_publishing_components/components/skip_link", {
|
109
|
+
text: t("components.chart.accessibility_link", chart_heading: chart_heading),
|
110
|
+
href: "##{table_id}"
|
111
|
+
} %>
|
112
|
+
</span>
|
102
113
|
<% end %>
|
103
114
|
|
104
115
|
<%= line_chart(chart_format_data, library: chart_library_options) %>
|
@@ -112,6 +123,9 @@
|
|
112
123
|
) do %>
|
113
124
|
<div tabindex="0" class="gem-c-chart__table-wrapper">
|
114
125
|
<table class="govuk-table">
|
126
|
+
<caption class="govuk-visually-hidden" id="<%= "data-table-caption-#{SecureRandom.hex(4)}" %>">
|
127
|
+
<%= t("components.chart.accessibility_heading", chart_heading: chart_heading) %>
|
128
|
+
</caption>
|
115
129
|
<% if table_direction == "horizontal" %>
|
116
130
|
<thead class="govuk-table__head">
|
117
131
|
<tr class="govuk-table__row">
|
data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb
CHANGED
@@ -303,18 +303,12 @@
|
|
303
303
|
class: "gem-c-layout-super-navigation-header__search-form",
|
304
304
|
id: "search",
|
305
305
|
data: {
|
306
|
-
module: "ga4-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
url: "/search/all",
|
313
|
-
index_section: 3,
|
314
|
-
index_section_count: 3,
|
315
|
-
},
|
316
|
-
ga4_form_include_text: "",
|
317
|
-
ga4_form_no_answer_undefined: "",
|
306
|
+
module: "ga4-search-tracker",
|
307
|
+
ga4_search_type: "header menu bar",
|
308
|
+
ga4_search_url: "/search/all",
|
309
|
+
ga4_search_section: "Search GOV.UK",
|
310
|
+
ga4_search_index_section: 3,
|
311
|
+
ga4_search_index_section_count: 3,
|
318
312
|
},
|
319
313
|
action: absolute_links_helper.make_url_absolute("/search/all"),
|
320
314
|
method: "get",
|
@@ -324,6 +318,7 @@
|
|
324
318
|
}
|
325
319
|
) do %>
|
326
320
|
<%= render "govuk_publishing_components/components/search", {
|
321
|
+
name: "keywords",
|
327
322
|
inline_label: false,
|
328
323
|
label_size: "m",
|
329
324
|
label_text: search_text,
|
@@ -11,6 +11,7 @@ accessibility_criteria: |
|
|
11
11
|
Charts must:
|
12
12
|
|
13
13
|
- use line colours with a contrast ratio higher than 4.5:1 against the background colour to meet WCAG AA
|
14
|
+
- contain a `chart_heading` option if `minimal` is not set to true, so that skip links and visually hidden headings are accurate
|
14
15
|
shared_accessibility_criteria:
|
15
16
|
- link
|
16
17
|
uses_component_wrapper_helper: true
|
data/config/locales/ar.yml
CHANGED
data/config/locales/az.yml
CHANGED
data/config/locales/be.yml
CHANGED
data/config/locales/bg.yml
CHANGED
data/config/locales/bn.yml
CHANGED
data/config/locales/cs.yml
CHANGED
data/config/locales/cy.yml
CHANGED
data/config/locales/da.yml
CHANGED
data/config/locales/de.yml
CHANGED
data/config/locales/dr.yml
CHANGED
data/config/locales/el.yml
CHANGED
data/config/locales/en.yml
CHANGED
@@ -34,7 +34,9 @@ en:
|
|
34
34
|
words: words
|
35
35
|
chart:
|
36
36
|
table_dropdown: Data table
|
37
|
-
accessibility_html: This chart is a visual representation of the data available in the
|
37
|
+
accessibility_html: This chart is a visual representation of the data available in the table.
|
38
|
+
accessibility_link: Skip to "%{chart_heading}" data table
|
39
|
+
accessibility_heading: Data table for "%{chart_heading}"
|
38
40
|
chat_entry:
|
39
41
|
heading: Try GOV.UK Chat
|
40
42
|
description: Sign up to GOV.UK’s experimental new AI tool and find answers to your business questions
|
data/config/locales/es-419.yml
CHANGED
data/config/locales/es.yml
CHANGED
data/config/locales/et.yml
CHANGED
data/config/locales/fa.yml
CHANGED
data/config/locales/fi.yml
CHANGED
data/config/locales/fr.yml
CHANGED
data/config/locales/gd.yml
CHANGED
data/config/locales/gu.yml
CHANGED
data/config/locales/he.yml
CHANGED
data/config/locales/hi.yml
CHANGED
data/config/locales/hr.yml
CHANGED
data/config/locales/hu.yml
CHANGED
data/config/locales/hy.yml
CHANGED
data/config/locales/id.yml
CHANGED
data/config/locales/is.yml
CHANGED
data/config/locales/it.yml
CHANGED
data/config/locales/ja.yml
CHANGED
data/config/locales/ka.yml
CHANGED
data/config/locales/kk.yml
CHANGED
data/config/locales/ko.yml
CHANGED
data/config/locales/lt.yml
CHANGED
data/config/locales/lv.yml
CHANGED
data/config/locales/ms.yml
CHANGED
data/config/locales/mt.yml
CHANGED
data/config/locales/nl.yml
CHANGED
data/config/locales/no.yml
CHANGED
data/config/locales/pa-pk.yml
CHANGED
data/config/locales/pa.yml
CHANGED
data/config/locales/pl.yml
CHANGED
data/config/locales/ps.yml
CHANGED
data/config/locales/pt.yml
CHANGED
data/config/locales/ro.yml
CHANGED
data/config/locales/ru.yml
CHANGED
data/config/locales/si.yml
CHANGED
data/config/locales/sk.yml
CHANGED
data/config/locales/sl.yml
CHANGED
data/config/locales/so.yml
CHANGED
data/config/locales/sq.yml
CHANGED
data/config/locales/sr.yml
CHANGED
data/config/locales/sv.yml
CHANGED
data/config/locales/sw.yml
CHANGED
data/config/locales/ta.yml
CHANGED
data/config/locales/th.yml
CHANGED
data/config/locales/tk.yml
CHANGED
data/config/locales/tr.yml
CHANGED
data/config/locales/uk.yml
CHANGED
data/config/locales/ur.yml
CHANGED
data/config/locales/uz.yml
CHANGED
data/config/locales/vi.yml
CHANGED
data/config/locales/zh-hk.yml
CHANGED
data/config/locales/zh-tw.yml
CHANGED
data/config/locales/zh.yml
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_publishing_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 44.
|
4
|
+
version: 44.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chartkick
|
@@ -455,6 +455,7 @@ files:
|
|
455
455
|
- app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-print-intent-tracker.js
|
456
456
|
- app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-schemas.js
|
457
457
|
- app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-scroll-tracker.js
|
458
|
+
- app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-search-tracker.js
|
458
459
|
- app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-smart-answer-results-tracker.js
|
459
460
|
- app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-specialist-link-tracker.js
|
460
461
|
- app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-video-tracker.js
|