govuk_publishing_components 14.0.0 → 15.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/javascripts/component_guide/accessibility-test.js +46 -8
- data/app/assets/javascripts/govuk_publishing_components/components/checkboxes.js +22 -0
- data/app/assets/stylesheets/component_guide/application.scss +9 -5
- data/app/views/govuk_publishing_components/components/docs/checkboxes.yml +18 -1
- data/app/views/govuk_publishing_components/components/docs/govspeak.yml +0 -4
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23c88deb6d387134dbbd3b685859363b74ead59e037184c74a58130e36a2dff1
|
4
|
+
data.tar.gz: 8defeb9c30b3c1e5f50a39b25e2b4a59c74b119dfcfd88b342cf7c140ea81df2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9186c00000ffd5aefd70e72229c038a8dbbfcaeec112b966c3fc50aca4e90eef3ca24f5f28cd057b8af8368819d01daa2c68cbddafecdd59a15d3bda9ab6bc22
|
7
|
+
data.tar.gz: e9194364870a3c2039dfe6e577991561c81fb1a6ab50a489579259651068267a89db9615b2882646f8f9560eb72fcf11baf54733c932000cc93051f6ee02a071
|
@@ -132,15 +132,53 @@
|
|
132
132
|
var activeElParent = _findParent(activeEl, '[data-module="test-a11y"]')
|
133
133
|
var wrapper = activeElParent.querySelector(resultContainerSelector)
|
134
134
|
|
135
|
-
if (wrapper) {
|
136
|
-
|
137
|
-
'<p>' + selectorObj.reasons.join('<br />') + '</p>' +
|
138
|
-
'<p>Element can be found using the selector:<br /><span class="selector">' +
|
139
|
-
selectorObj.selector +
|
140
|
-
'</span></p>'
|
141
|
-
|
142
|
-
wrapper.insertAdjacentHTML('beforeend', resultHTML)
|
135
|
+
if (!wrapper) {
|
136
|
+
return
|
143
137
|
}
|
138
|
+
|
139
|
+
// Section to announce the overall problem.
|
140
|
+
var headerNodeLink = document.createElement('a')
|
141
|
+
headerNodeLink.href = result.url
|
142
|
+
headerNodeLink.textContent = "(see guidance)"
|
143
|
+
|
144
|
+
var headerNode = document.createElement('h3')
|
145
|
+
headerNode.textContent = result.summary + ' (' + result.id + ') '
|
146
|
+
headerNode.appendChild(headerNodeLink)
|
147
|
+
|
148
|
+
// Section to explain the reasons
|
149
|
+
var reasonsListNode = document.createElement('ul')
|
150
|
+
selectorObj.reasons.forEach(function (reason) {
|
151
|
+
var listItemNode = document.createElement('li')
|
152
|
+
listItemNode.textContent = reason
|
153
|
+
reasonsListNode.appendChild(listItemNode)
|
154
|
+
})
|
155
|
+
|
156
|
+
var reasonsHeaderNode = document.createElement('h4')
|
157
|
+
reasonsHeaderNode.textContent = 'Possible reasons why:'
|
158
|
+
|
159
|
+
var reasonsNode = document.createElement('div')
|
160
|
+
reasonsNode.appendChild(reasonsHeaderNode)
|
161
|
+
reasonsNode.appendChild(reasonsListNode)
|
162
|
+
|
163
|
+
// Section to help find the element
|
164
|
+
var findHeader = document.createElement('h4')
|
165
|
+
findHeader.textContent = 'Element can be found using the selector:'
|
166
|
+
|
167
|
+
var findSelectorNode = document.createElement('span')
|
168
|
+
findSelectorNode.className = 'selector'
|
169
|
+
findSelectorNode.textContent = selectorObj.selector
|
170
|
+
|
171
|
+
var findNode = document.createElement('p')
|
172
|
+
findNode.appendChild(findHeader)
|
173
|
+
findNode.appendChild(findSelectorNode)
|
174
|
+
|
175
|
+
// Put all the sections together
|
176
|
+
var resultHTML = document.createElement('div')
|
177
|
+
resultHTML.appendChild(headerNode)
|
178
|
+
resultHTML.appendChild(reasonsNode)
|
179
|
+
resultHTML.appendChild(findNode)
|
180
|
+
|
181
|
+
wrapper.appendChild(resultHTML)
|
144
182
|
})
|
145
183
|
})
|
146
184
|
}
|
@@ -23,6 +23,28 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
23
23
|
}
|
24
24
|
});
|
25
25
|
|
26
|
+
$(scope).find('input[type=checkbox]').on('change', function(e) {
|
27
|
+
if (GOVUK.analytics && GOVUK.analytics.trackEvent) {
|
28
|
+
var $checkbox = $(e.target);
|
29
|
+
var category = $checkbox.data("track-category");
|
30
|
+
if (typeof category !== "undefined") {
|
31
|
+
var isChecked = $checkbox.is(":checked");
|
32
|
+
var uncheckTrackCategory = $checkbox.data("uncheck-track-category");
|
33
|
+
if (!isChecked && typeof uncheckTrackCategory !== "undefined") {
|
34
|
+
category = uncheckTrackCategory;
|
35
|
+
}
|
36
|
+
var action = $checkbox.data("track-action");
|
37
|
+
var options = $checkbox.data("track-options");
|
38
|
+
if (typeof options !== 'object' || options === null) {
|
39
|
+
options = {};
|
40
|
+
}
|
41
|
+
options['value'] = $checkbox.data("track-value");
|
42
|
+
options['label'] = $checkbox.data("track-label");
|
43
|
+
GOVUK.analytics.trackEvent(category, action, options);
|
44
|
+
}
|
45
|
+
}
|
46
|
+
});
|
47
|
+
|
26
48
|
};
|
27
49
|
|
28
50
|
this.toggleNestedCheckboxes = function(scope, checkbox) {
|
@@ -172,12 +172,9 @@
|
|
172
172
|
display: none;
|
173
173
|
}
|
174
174
|
|
175
|
-
h3 {
|
176
|
-
@include govuk-font($size: 19, $weight: bold);
|
177
|
-
}
|
178
|
-
|
179
175
|
p,
|
180
|
-
h3
|
176
|
+
h3,
|
177
|
+
h4 {
|
181
178
|
margin-top: 0;
|
182
179
|
margin-bottom: $govuk-gutter / 2;
|
183
180
|
}
|
@@ -190,6 +187,13 @@
|
|
190
187
|
margin-top: $govuk-gutter;
|
191
188
|
}
|
192
189
|
|
190
|
+
ul {
|
191
|
+
margin: 0;
|
192
|
+
padding: 0;
|
193
|
+
padding-left: 1em;
|
194
|
+
margin-bottom: 1em;
|
195
|
+
}
|
196
|
+
|
193
197
|
.selector {
|
194
198
|
font-style: italic;
|
195
199
|
}
|
@@ -114,7 +114,7 @@ examples:
|
|
114
114
|
- label: "Blue"
|
115
115
|
value: "blue"
|
116
116
|
checkboxes_with_data_attributes:
|
117
|
-
description: Data attributes such as tracking can be applied if required.
|
117
|
+
description: Data attributes such as tracking can be applied if required. This will fire tracking identical tracking events on check and uncheck. See below to send different events on uncheck.
|
118
118
|
data:
|
119
119
|
name: "With tracking"
|
120
120
|
items:
|
@@ -129,6 +129,23 @@ examples:
|
|
129
129
|
dimension29: "Tracked"
|
130
130
|
}
|
131
131
|
}
|
132
|
+
checkboxes_with_data_attributes_and_custom_uncheck_event_category:
|
133
|
+
description: It can send a different tracking event category for an uncheck. This is handled automatically
|
134
|
+
data:
|
135
|
+
name: "With tracking and a custom uncheck category"
|
136
|
+
items:
|
137
|
+
- label: "Tracked"
|
138
|
+
value: "tracked"
|
139
|
+
data_attributes: {
|
140
|
+
track_category: "checkboxClicked",
|
141
|
+
untrack_category: "checkboxUnchecked",
|
142
|
+
track_label: "/news-and-communications",
|
143
|
+
track_action: "news",
|
144
|
+
track_options: {
|
145
|
+
dimension28: 2,
|
146
|
+
dimension29: "Tracked"
|
147
|
+
}
|
148
|
+
}
|
132
149
|
with_aria_controls_attributes:
|
133
150
|
description: Aria controls attributes are applied to the checkboxes only if Javascript is enabled.
|
134
151
|
data:
|
@@ -279,10 +279,6 @@ examples:
|
|
279
279
|
<li>تابعنا باللغة العربية عبر</li>
|
280
280
|
<li>تابعنا باللغة العربية عبر تويتر </li>
|
281
281
|
</ul>
|
282
|
-
with_bold_unstyled:
|
283
|
-
data:
|
284
|
-
block: |
|
285
|
-
<p>This content has <strong>text in strong tags</strong>, but they are not styled as bold</p>
|
286
282
|
with_youtube_embed:
|
287
283
|
data:
|
288
284
|
block: |
|