govuk_publishing_components 21.55.1 → 21.56.1
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/lib/govspeak/youtube-link-enhancement.js +5 -4
- data/app/assets/stylesheets/govuk_publishing_components/component_support.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss +1 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/_summary-list.scss +18 -5
- data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_link.scss +17 -0
- data/app/controllers/govuk_publishing_components/component_guide_controller.rb +26 -16
- data/app/views/govuk_publishing_components/components/_contextual_breadcrumbs.html.erb +11 -7
- data/app/views/govuk_publishing_components/components/_summary_list.html.erb +34 -14
- data/app/views/govuk_publishing_components/components/docs/summary_list.yml +27 -0
- data/config/locales/en.yml +3 -0
- data/lib/govuk_publishing_components.rb +2 -1
- data/lib/govuk_publishing_components/presenters/breadcrumb_selector.rb +52 -44
- data/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_ancestors.rb +41 -0
- data/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_priority.rb +1 -0
- data/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_taxons.rb +4 -0
- data/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_topic.rb +38 -0
- data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +15 -4
- data/lib/govuk_publishing_components/presenters/page_with_step_by_step_navigation.rb +3 -1
- data/lib/govuk_publishing_components/presenters/related_navigation_helper.rb +18 -17
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/axe-core/CHANGELOG.md +11 -0
- data/node_modules/axe-core/axe.js +36 -9
- data/node_modules/axe-core/axe.min.js +2 -2
- data/node_modules/axe-core/bower.json +1 -1
- data/node_modules/axe-core/lib/checks/color/color-contrast.js +2 -2
- data/node_modules/axe-core/lib/checks/lists/listitem.js +1 -1
- data/node_modules/axe-core/lib/checks/mobile/meta-viewport-scale.js +3 -0
- data/node_modules/axe-core/lib/commons/dom/is-visible.js +37 -19
- data/node_modules/axe-core/lib/core/public/configure.js +26 -0
- data/node_modules/axe-core/lib/rules/aria-input-field-name.json +1 -1
- data/node_modules/axe-core/package.json +12 -12
- data/node_modules/axe-core/sri-history.json +4 -0
- metadata +5 -3
- data/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_parent.rb +0 -39
@@ -0,0 +1,41 @@
|
|
1
|
+
module GovukPublishingComponents
|
2
|
+
module Presenters
|
3
|
+
# @private
|
4
|
+
class ContentBreadcrumbsBasedOnAncestors
|
5
|
+
def self.call(content_item)
|
6
|
+
new(content_item).breadcrumbs
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize(content_item)
|
10
|
+
@content_item = ContentItem.new(content_item)
|
11
|
+
end
|
12
|
+
|
13
|
+
def breadcrumbs
|
14
|
+
ordered_ancestors = all_ancestors.map do |ancestor|
|
15
|
+
{ title: ancestor.title, url: ancestor.base_path }
|
16
|
+
end
|
17
|
+
|
18
|
+
ordered_ancestors << { title: "Home", url: "/" }
|
19
|
+
ordered_ancestors.reverse!
|
20
|
+
ordered_ancestors
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
attr_reader :content_item
|
26
|
+
|
27
|
+
def all_ancestors
|
28
|
+
ancestors = []
|
29
|
+
|
30
|
+
parent = content_item.parent
|
31
|
+
while parent
|
32
|
+
ancestors << parent
|
33
|
+
|
34
|
+
parent = parent.parent
|
35
|
+
end
|
36
|
+
|
37
|
+
ancestors
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -6,6 +6,7 @@ module GovukPublishingComponents
|
|
6
6
|
# and the bottom one the lowest priority
|
7
7
|
PRIORITY_TAXONS = {
|
8
8
|
education_coronavirus: "272308f4-05c8-4d0d-abc7-b7c2e3ccd249",
|
9
|
+
worker_coronavirus: "b7f57213-4b16-446d-8ded-81955d782680",
|
9
10
|
business_coronavirus: "65666cdf-b177-4d79-9687-b9c32805e450",
|
10
11
|
}.freeze
|
11
12
|
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module GovukPublishingComponents
|
2
|
+
module Presenters
|
3
|
+
class ContentBreadcrumbsBasedOnTopic
|
4
|
+
def self.call(content_item)
|
5
|
+
new(content_item).breadcrumbs
|
6
|
+
end
|
7
|
+
|
8
|
+
attr_reader :content_item
|
9
|
+
|
10
|
+
def initialize(content_item)
|
11
|
+
@content_item = content_item
|
12
|
+
end
|
13
|
+
|
14
|
+
def breadcrumbs
|
15
|
+
breadcrumbs = [{ title: "Home", url: "/" }]
|
16
|
+
return breadcrumbs unless topics.present?
|
17
|
+
|
18
|
+
breadcrumbs << topic_breadcrumb
|
19
|
+
breadcrumbs
|
20
|
+
end
|
21
|
+
|
22
|
+
def topic_breadcrumb
|
23
|
+
{
|
24
|
+
title: first_topic["title"],
|
25
|
+
url: first_topic["base_path"],
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
def first_topic
|
30
|
+
topics.first
|
31
|
+
end
|
32
|
+
|
33
|
+
def topics
|
34
|
+
@topics ||= content_item.dig("links", "topics")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -26,15 +26,22 @@ module GovukPublishingComponents
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def taxon_breadcrumbs
|
29
|
-
@taxon_breadcrumbs ||= ContentBreadcrumbsBasedOnTaxons.
|
29
|
+
@taxon_breadcrumbs ||= ContentBreadcrumbsBasedOnTaxons.call(content_item)
|
30
30
|
end
|
31
31
|
|
32
32
|
def priority_breadcrumbs
|
33
33
|
@priority_breadcrumbs ||= ContentBreadcrumbsBasedOnPriority.call(content_item)
|
34
34
|
end
|
35
35
|
|
36
|
+
def topic_breadcrumbs
|
37
|
+
@topic_breadcrumbs ||= ContentBreadcrumbsBasedOnTopic.call(content_item)
|
38
|
+
end
|
39
|
+
|
36
40
|
def breadcrumbs
|
37
|
-
|
41
|
+
breadcrumbs_based_on_ancestors
|
42
|
+
end
|
43
|
+
|
44
|
+
def finder_breadcrumbs
|
38
45
|
return [] unless parent_finder
|
39
46
|
|
40
47
|
[
|
@@ -77,6 +84,10 @@ module GovukPublishingComponents
|
|
77
84
|
content_item["document_type"] == "html_publication"
|
78
85
|
end
|
79
86
|
|
87
|
+
def content_has_a_topic?
|
88
|
+
content_item.dig("links", "topics").present?
|
89
|
+
end
|
90
|
+
|
80
91
|
def tagged_to_brexit?
|
81
92
|
taxons = content_item.dig("links", "taxons").to_a
|
82
93
|
brexit_taxon = "d6c2de5d-ef90-45d1-82d4-5f2438369eea"
|
@@ -119,8 +130,8 @@ module GovukPublishingComponents
|
|
119
130
|
step_nav_helper.show_also_part_of_step_nav?
|
120
131
|
end
|
121
132
|
|
122
|
-
def
|
123
|
-
|
133
|
+
def breadcrumbs_based_on_ancestors
|
134
|
+
ContentBreadcrumbsBasedOnAncestors.call(content_item)
|
124
135
|
end
|
125
136
|
|
126
137
|
def step_nav_helper
|
@@ -3,6 +3,8 @@ module GovukPublishingComponents
|
|
3
3
|
# @private
|
4
4
|
# Only used by the step by step component
|
5
5
|
class PageWithStepByStepNavigation
|
6
|
+
MAX_SECTION_LENGTH = RelatedNavigationHelper::MAX_SECTION_LENGTH
|
7
|
+
|
6
8
|
def initialize(content_store_response, current_path, query_parameters = {})
|
7
9
|
@content_item = content_store_response.to_h.deep_symbolize_keys
|
8
10
|
@current_path = current_path
|
@@ -48,7 +50,7 @@ module GovukPublishingComponents
|
|
48
50
|
end
|
49
51
|
|
50
52
|
def show_also_part_of_step_nav?
|
51
|
-
active_step_by_step? && also_part_of_step_nav.any? && step_navs_combined_list.count <
|
53
|
+
active_step_by_step? && also_part_of_step_nav.any? && step_navs_combined_list.count < MAX_SECTION_LENGTH
|
52
54
|
end
|
53
55
|
|
54
56
|
def related_links
|
@@ -31,7 +31,7 @@ module GovukPublishingComponents
|
|
31
31
|
}
|
32
32
|
when :footer
|
33
33
|
{
|
34
|
-
"topics" =>
|
34
|
+
"topics" => related_topics_or_taxons,
|
35
35
|
"topical_events" => related_topical_events,
|
36
36
|
"world_locations" => related_world_locations,
|
37
37
|
"statistical_data_sets" => related_statistical_data_sets,
|
@@ -43,7 +43,7 @@ module GovukPublishingComponents
|
|
43
43
|
"related_items" => related_items,
|
44
44
|
"related_guides" => related_guides,
|
45
45
|
"collections" => related_document_collections,
|
46
|
-
"topics" =>
|
46
|
+
"topics" => related_topics_or_taxons,
|
47
47
|
"topical_events" => related_topical_events,
|
48
48
|
"world_locations" => related_world_locations,
|
49
49
|
"statistical_data_sets" => related_statistical_data_sets,
|
@@ -162,26 +162,27 @@ module GovukPublishingComponents
|
|
162
162
|
end
|
163
163
|
|
164
164
|
def related_taxons
|
165
|
-
content_item_links_for("taxons", only: "taxon")
|
165
|
+
@related_taxons ||= content_item_links_for("taxons", only: "taxon")
|
166
166
|
end
|
167
167
|
|
168
|
-
def
|
169
|
-
if
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
else
|
174
|
-
[]
|
175
|
-
end
|
168
|
+
def related_topics_or_taxons
|
169
|
+
return related_topics if related_topics.any?
|
170
|
+
return related_taxons if related_taxons.any?
|
171
|
+
|
172
|
+
[]
|
176
173
|
end
|
177
174
|
|
178
|
-
def
|
179
|
-
|
180
|
-
|
175
|
+
def related_topics
|
176
|
+
@related_topics ||= begin
|
177
|
+
mainstream_browse_page_links = content_item_links_for("mainstream_browse_pages", only: "mainstream_browse_page")
|
178
|
+
topic_links = content_item_links_for("topics", only: "topic")
|
179
|
+
|
180
|
+
return topic_links if topic_links.present? && mainstream_browse_page_links.empty?
|
181
181
|
|
182
|
-
|
183
|
-
|
184
|
-
|
182
|
+
mainstream_browse_page_links + topic_links.find_all do |topic_link|
|
183
|
+
mainstream_browse_page_links.none? do |mainstream_browse_page_link|
|
184
|
+
mainstream_browse_page_link[:text] == topic_link[:text]
|
185
|
+
end
|
185
186
|
end
|
186
187
|
end
|
187
188
|
end
|
@@ -2,6 +2,17 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
4
4
|
|
5
|
+
### [3.5.5](https://github.com/dequelabs/axe-core/compare/v3.5.4...v3.5.5) (2020-06-16)
|
6
|
+
|
7
|
+
### Bug Fixes
|
8
|
+
|
9
|
+
- **aria-input-field-name:** add the missing word must to help metadata ([b0f5562](https://github.com/dequelabs/axe-core/commit/b0f5562ac2a746e8ac78f6e483e39162680f3a22))
|
10
|
+
- **color-contrast:** fix font-weight calculation for safari ([205b587](https://github.com/dequelabs/axe-core/commit/205b58709c280f00100bf24a7b6bf15da50ed0ed))
|
11
|
+
- **configure:** validate rules and checks properties ([8c91ead](https://github.com/dequelabs/axe-core/commit/8c91ead900fd3cab58f77af45cce54d02e734a8e))
|
12
|
+
- **is-visible:** return false for opacity: 0 and 0 height scrollable regions ([86ada3f](https://github.com/dequelabs/axe-core/commit/86ada3f7cef5b1fbcaad37b8acfaee93566ba8bf))
|
13
|
+
- **listitem:** do not fail for parent with role=presentation|none ([a3ddc6e](https://github.com/dequelabs/axe-core/commit/a3ddc6e1e43716b761e8bb42fba4842d88f813dc))
|
14
|
+
- **meta-viewport:** don't throw error if viewport property doesn't have a value ([2176794](https://github.com/dequelabs/axe-core/commit/2176794f8a831c8303984039e4a07b99d368b111))
|
15
|
+
|
5
16
|
### [3.5.4](https://github.com/dequelabs/axe-core/compare/v3.5.3...v3.5.4) (2020-05-22)
|
6
17
|
|
7
18
|
### Bug Fixes
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! axe v3.5.
|
1
|
+
/*! axe v3.5.5
|
2
2
|
* Copyright (c) 2020 Deque Systems, Inc.
|
3
3
|
*
|
4
4
|
* Your use of this Source Code Form is subject to the terms of the Mozilla Public
|
@@ -27,7 +27,7 @@
|
|
27
27
|
return _typeof(obj);
|
28
28
|
}
|
29
29
|
var axe = axe || {};
|
30
|
-
axe.version = '3.5.
|
30
|
+
axe.version = '3.5.5';
|
31
31
|
if (typeof define === 'function' && define.amd) {
|
32
32
|
define('axe-core', [], function() {
|
33
33
|
'use strict';
|
@@ -9976,13 +9976,25 @@
|
|
9976
9976
|
audit.reporter = spec.reporter;
|
9977
9977
|
}
|
9978
9978
|
if (spec.checks) {
|
9979
|
+
if (!Array.isArray(spec.checks)) {
|
9980
|
+
throw new TypeError('Checks property must be an array');
|
9981
|
+
}
|
9979
9982
|
spec.checks.forEach(function(check) {
|
9983
|
+
if (!check.id) {
|
9984
|
+
throw new TypeError('Configured check '.concat(JSON.stringify(check), ' is invalid. Checks must be an object with at least an id property'));
|
9985
|
+
}
|
9980
9986
|
audit.addCheck(check);
|
9981
9987
|
});
|
9982
9988
|
}
|
9983
9989
|
var modifiedRules = [];
|
9984
9990
|
if (spec.rules) {
|
9991
|
+
if (!Array.isArray(spec.rules)) {
|
9992
|
+
throw new TypeError('Rules property must be an array');
|
9993
|
+
}
|
9985
9994
|
spec.rules.forEach(function(rule) {
|
9995
|
+
if (!rule.id) {
|
9996
|
+
throw new TypeError('Configured rule '.concat(JSON.stringify(rule), ' is invalid. Rules must be an object with at least an id property'));
|
9997
|
+
}
|
9986
9998
|
modifiedRules.push(rule.id);
|
9987
9999
|
audit.addRule(rule);
|
9988
10000
|
});
|
@@ -13698,7 +13710,7 @@
|
|
13698
13710
|
},
|
13699
13711
|
'aria-input-field-name': {
|
13700
13712
|
description: 'Ensures every ARIA input field has an accessible name',
|
13701
|
-
help: 'ARIA input fields have an accessible name'
|
13713
|
+
help: 'ARIA input fields must have an accessible name'
|
13702
13714
|
},
|
13703
13715
|
'aria-required-attr': {
|
13704
13716
|
description: 'Ensures elements with ARIA roles have all required ARIA attributes',
|
@@ -16679,8 +16691,8 @@
|
|
16679
16691
|
var fgColor = color.getForegroundColor(node, noScroll, bgColor);
|
16680
16692
|
var nodeStyle = window.getComputedStyle(node);
|
16681
16693
|
var fontSize = parseFloat(nodeStyle.getPropertyValue('font-size'));
|
16682
|
-
var fontWeight =
|
16683
|
-
var bold =
|
16694
|
+
var fontWeight = nodeStyle.getPropertyValue('font-weight');
|
16695
|
+
var bold = parseFloat(fontWeight) >= 700 || fontWeight === 'bold';
|
16684
16696
|
var cr = color.hasValidContrastRatio(bgColor, fgColor, fontSize, bold);
|
16685
16697
|
var truncatedResult = Math.floor(cr.contrastRatio * 100) / 100;
|
16686
16698
|
var missing;
|
@@ -17604,7 +17616,7 @@
|
|
17604
17616
|
}
|
17605
17617
|
var parentTagName = parent.nodeName.toUpperCase();
|
17606
17618
|
var parentRole = (parent.getAttribute('role') || '').toLowerCase();
|
17607
|
-
if (
|
17619
|
+
if ([ 'presentation', 'none', 'list' ].includes(parentRole)) {
|
17608
17620
|
return true;
|
17609
17621
|
}
|
17610
17622
|
if (parentRole && axe.commons.aria.isValidRole(parentRole)) {
|
@@ -18006,6 +18018,9 @@
|
|
18006
18018
|
return out;
|
18007
18019
|
}
|
18008
18020
|
var _contentValue$split = contentValue.split('='), _contentValue$split2 = _slicedToArray(_contentValue$split, 2), key = _contentValue$split2[0], value = _contentValue$split2[1];
|
18021
|
+
if (!key || !value) {
|
18022
|
+
return out;
|
18023
|
+
}
|
18009
18024
|
var curatedKey = key.toLowerCase().trim();
|
18010
18025
|
var curatedValue = value.toLowerCase().trim();
|
18011
18026
|
if (curatedKey === 'maximum-scale' && curatedValue === 'yes') {
|
@@ -18048,6 +18063,9 @@
|
|
18048
18063
|
return out;
|
18049
18064
|
}
|
18050
18065
|
var _contentValue$split3 = contentValue.split('='), _contentValue$split4 = _slicedToArray(_contentValue$split3, 2), key = _contentValue$split4[0], value = _contentValue$split4[1];
|
18066
|
+
if (!key || !value) {
|
18067
|
+
return out;
|
18068
|
+
}
|
18051
18069
|
var curatedKey = key.toLowerCase().trim();
|
18052
18070
|
var curatedValue = value.toLowerCase().trim();
|
18053
18071
|
if (curatedKey === 'maximum-scale' && curatedValue === 'yes') {
|
@@ -22193,12 +22211,21 @@
|
|
22193
22211
|
return false;
|
22194
22212
|
}
|
22195
22213
|
var nodeName = el.nodeName.toUpperCase();
|
22196
|
-
if (nodeName !== 'AREA' && style.getPropertyValue('display') === 'none' || [ 'STYLE', 'SCRIPT', 'NOSCRIPT', 'TEMPLATE' ].includes(nodeName) || !screenReader && isClipped(style) || !recursed && (style.getPropertyValue('visibility') === 'hidden' || !screenReader && dom.isOffscreen(el)) || screenReader && el.getAttribute('aria-hidden') === 'true') {
|
22197
|
-
return false;
|
22198
|
-
}
|
22199
22214
|
if (nodeName === 'AREA') {
|
22200
22215
|
return isAreaVisible(el, screenReader, recursed);
|
22201
22216
|
}
|
22217
|
+
if (style.getPropertyValue('display') === 'none' || [ 'STYLE', 'SCRIPT', 'NOSCRIPT', 'TEMPLATE' ].includes(nodeName)) {
|
22218
|
+
return false;
|
22219
|
+
}
|
22220
|
+
if (screenReader && el.getAttribute('aria-hidden') === 'true') {
|
22221
|
+
return false;
|
22222
|
+
}
|
22223
|
+
if (!screenReader && (isClipped(style) || style.getPropertyValue('opacity') === '0' || axe.utils.getScroll(el) && parseInt(style.getPropertyValue('height')) === 0)) {
|
22224
|
+
return false;
|
22225
|
+
}
|
22226
|
+
if (!recursed && (style.getPropertyValue('visibility') === 'hidden' || !screenReader && axe.commons.dom.isOffscreen(el))) {
|
22227
|
+
return false;
|
22228
|
+
}
|
22202
22229
|
var parent = el.assignedSlot ? el.assignedSlot : el.parentNode;
|
22203
22230
|
var isVisible = false;
|
22204
22231
|
if (parent) {
|