govuk_tech_docs 2.3.0 → 2.4.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.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +12 -0
  4. data/govuk_tech_docs.gemspec +1 -1
  5. data/lib/assets/javascripts/_modules/collapsible-navigation.js +7 -7
  6. data/lib/assets/javascripts/_modules/in-page-navigation.js +2 -4
  7. data/lib/assets/stylesheets/modules/_search.scss +1 -10
  8. data/lib/assets/stylesheets/modules/_technical-documentation.scss +1 -1
  9. data/lib/govuk_tech_docs/table_of_contents/heading.rb +5 -1
  10. data/lib/govuk_tech_docs/table_of_contents/heading_tree_renderer.rb +2 -2
  11. data/lib/govuk_tech_docs/table_of_contents/helpers.rb +6 -3
  12. data/lib/govuk_tech_docs/tech_docs_html_renderer.rb +1 -1
  13. data/lib/govuk_tech_docs/version.rb +1 -1
  14. data/lib/source/layouts/_header.erb +6 -2
  15. data/node_modules/govuk-frontend/govuk/all.js +61 -3
  16. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_index.scss +1 -0
  17. data/node_modules/govuk-frontend/govuk/components/button/_index.scss +10 -4
  18. data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +49 -34
  19. data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +61 -3
  20. data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +22 -10
  21. data/node_modules/govuk-frontend/govuk/components/header/_index.scss +11 -7
  22. data/node_modules/govuk-frontend/govuk/components/input/_index.scss +4 -0
  23. data/node_modules/govuk-frontend/govuk/components/skip-link/_index.scss +2 -0
  24. data/node_modules/govuk-frontend/govuk/components/warning-text/_index.scss +0 -1
  25. data/node_modules/govuk-frontend/govuk/core/_template.scss +0 -1
  26. data/node_modules/govuk-frontend/govuk/helpers/_links.scss +6 -0
  27. data/node_modules/govuk-frontend/govuk/objects/_button-group.scss +9 -2
  28. data/node_modules/govuk-frontend/govuk/objects/_width-container.scss +4 -0
  29. data/package-lock.json +3 -3
  30. data/package.json +1 -1
  31. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a16d9b95456a7ddffdb052922793613e157fa866e7a2e69a7d42b83b858e141f
4
- data.tar.gz: 34f980b0d8a4caf7cc28dd15f103f92cc456f9cd41d6a4b478881eb19b6d4266
3
+ metadata.gz: 67ad7c3f867522ea35890520f14663c8e12dfd48506cdc8d59cb1f74c7d263be
4
+ data.tar.gz: 10976db4f9c215001924964cde8aa82ed900eb205af720fc6ee1930ce3f34383
5
5
  SHA512:
6
- metadata.gz: 381565277ad19f4dc82047604b54a26430107b81eeee02550c212d361883cf380c05114ffef36865b1ff3892a254555b9547876f261dcab71ef15d37364962aa
7
- data.tar.gz: 1d1812a952608da41e1af4f52a8d9d22d8e99fb55e507f1056b1e5d19c025141b1fa4e20aba2659c4c48728f4de5c35561cff0f099a7556fd6e547d462d78d6a
6
+ metadata.gz: ffd8c3389b4042b84f468823674df37c04eaae5a6c031b85d0200327a33ebd7a864e97e22a95d5c3ebb46ae4360b3ddc25cfefd940e2bb1e1f69ff1332fc744a
7
+ data.tar.gz: dc1402bf0283a38361f77691e45a09c861cca5430ba9cdc9a270e84718a027c57877a056c36a2a11902ee30c3d199805a6db466a31ea73ba8d953706cd1d29ca
data/.gitignore CHANGED
@@ -29,6 +29,7 @@
29
29
  .rvmrc
30
30
 
31
31
  /example/build
32
+ /example/.bundle
32
33
  /example/.sass-cache
33
34
 
34
35
  Gemfile.lock
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ ## 2.4.0
6
+
7
+ - [Bump redcarpet to 3.5.1 to fix CVE-2020-26298](https://github.com/alphagov/tech-docs-gem/pull/226)
8
+ - [#238: Move the aria-expanded attribute to the correct element](https://github.com/alphagov/tech-docs-gem/pull/238)
9
+ - [#240: Update menu html structure so it's one single hierarchical list](https://github.com/alphagov/tech-docs-gem/pull/240)
10
+ - [#244: Don't change the focus of the page on initial load](https://github.com/alphagov/tech-docs-gem/pull/244)
11
+ - [#243: Fix focus state for links containing inline code](https://github.com/alphagov/tech-docs-gem/pull/243)
12
+ - [#245: Fix focus state for search results ‘Close’ button](https://github.com/alphagov/tech-docs-gem/pull/245)
13
+ - [#246: Update GOV.UK Frontend to v3.13.0](https://github.com/alphagov/tech-docs-gem/pull/246)
14
+
3
15
  ## 2.3.0
4
16
 
5
17
  - [#232: Update GOV.UK Frontend and use new link styles](https://github.com/alphagov/tech-docs-gem/pull/232)
@@ -43,7 +43,7 @@ Gem::Specification.new do |spec|
43
43
  spec.add_dependency "middleman-syntax", "~> 3.2.0"
44
44
  spec.add_dependency "nokogiri"
45
45
  spec.add_dependency "openapi3_parser", "~> 0.9.0"
46
- spec.add_dependency "redcarpet", "~> 3.5.0"
46
+ spec.add_dependency "redcarpet", "~> 3.5.1"
47
47
 
48
48
  spec.add_development_dependency "byebug"
49
49
  spec.add_development_dependency "capybara", "~> 3.32"
@@ -34,10 +34,9 @@
34
34
  arrayOfIds.push(uniqueId)
35
35
  $(this).addClass('collapsible__body')
36
36
  .attr('id', uniqueId)
37
- .attr('aria-expanded', 'false')
38
37
  })
39
38
  $heading.addClass('collapsible__heading')
40
- .after('<button class="collapsible__toggle" aria-controls="' + arrayOfIds.join(' ') + '"><span class="collapsible__toggle-label">Expand ' + $heading.text() + '</span><span class="collapsible__toggle-icon" aria-hidden="true"></button>')
39
+ .after('<button class="collapsible__toggle" aria-expanded="false" aria-controls="' + arrayOfIds.join(' ') + '"><span class="collapsible__toggle-label">Expand ' + $heading.text() + '</span><span class="collapsible__toggle-icon" aria-hidden="true"></button>')
41
40
  $topLevelItem.on('click', '.collapsible__toggle', function (e) {
42
41
  e.preventDefault()
43
42
  var $parent = $(this).parent()
@@ -47,14 +46,15 @@
47
46
  }
48
47
 
49
48
  function toggleHeading ($topLevelItem) {
50
- var isOpen = $topLevelItem.hasClass('is-open')
49
+ var setOpen = !$topLevelItem.hasClass('is-open')
50
+
51
51
  var $heading = $topLevelItem.find('> a')
52
- var $body = $topLevelItem.find('.collapsible__body')
52
+ var $button = $topLevelItem.find('.collapsible__toggle')
53
53
  var $toggleLabel = $topLevelItem.find('.collapsible__toggle-label')
54
54
 
55
- $topLevelItem.toggleClass('is-open', !isOpen)
56
- $body.attr('aria-expanded', isOpen ? 'false' : 'true')
57
- $toggleLabel.text(isOpen ? 'Expand ' + $heading.text() : 'Collapse ' + $heading.text())
55
+ $topLevelItem.toggleClass('is-open', setOpen)
56
+ $button.attr('aria-expanded', setOpen ? 'true' : 'false')
57
+ $toggleLabel.text(setOpen ? 'Collapse ' + $heading.text() : 'Expand ' + $heading.text())
58
58
  }
59
59
 
60
60
  function openActiveHeading () {
@@ -47,14 +47,12 @@
47
47
  fragment = fragmentForFirstElementInView()
48
48
  }
49
49
 
50
- handleChangeInActiveItem(fragment)
50
+ highlightActiveItemInToc(fragment)
51
51
  }
52
52
 
53
53
  function handleScrollEvent () {
54
- handleChangeInActiveItem(fragmentForFirstElementInView())
55
- }
54
+ var fragment = fragmentForFirstElementInView()
56
55
 
57
- function handleChangeInActiveItem (fragment) {
58
56
  storeCurrentPositionInHistoryApi(fragment)
59
57
  highlightActiveItemInToc(fragment)
60
58
  }
@@ -130,16 +130,7 @@ html.has-search-results-open {
130
130
  cursor: pointer;
131
131
 
132
132
  &:focus {
133
- background-color: $govuk-focus-colour;
134
- outline: $govuk-focus-width solid transparent;
135
- box-shadow: inset 0 0 0 1px $govuk-focus-colour;
136
- }
137
-
138
- &:focus:not(:active):not(:hover) {
139
- border-color: $govuk-focus-colour;
140
- color: $govuk-focus-text-colour;
141
- background-color: $govuk-focus-colour;
142
- box-shadow: 0 2px 0 $govuk-focus-text-colour;
133
+ @include govuk-focused-text;
143
134
  }
144
135
 
145
136
  &::after {
@@ -185,7 +185,7 @@
185
185
  }
186
186
 
187
187
  a:focus code {
188
- background: inherit;
188
+ background: transparent;
189
189
  color: inherit;
190
190
  }
191
191
 
@@ -13,7 +13,11 @@ module GovukTechDocs
13
13
  end
14
14
 
15
15
  def href
16
- @page_url + "#" + @attributes["id"]
16
+ if @page_url != "" && size == 1
17
+ @page_url
18
+ else
19
+ @page_url + "#" + @attributes["id"]
20
+ end
17
21
  end
18
22
 
19
23
  def title
@@ -24,7 +24,7 @@ module GovukTechDocs
24
24
  end
25
25
 
26
26
  if tree.children.any? && level < @max_level
27
- output += indentation + "<ul>\n"
27
+ output += indentation + "<ul>\n" unless level.zero?
28
28
 
29
29
  tree.children.each do |child|
30
30
  output += indentation + INDENTATION_INCREMENT + "<li>\n"
@@ -36,7 +36,7 @@ module GovukTechDocs
36
36
  output += indentation + INDENTATION_INCREMENT + "</li>\n"
37
37
  end
38
38
 
39
- output += indentation + "</ul>\n"
39
+ output += indentation + "</ul>\n" unless level.zero?
40
40
  end
41
41
 
42
42
  output
@@ -32,7 +32,8 @@ module GovukTechDocs
32
32
  # Sort by weight frontmatter
33
33
  resources = resources
34
34
  .sort_by { |r| [r.data.weight ? 0 : 1, r.data.weight || 0] }
35
- output = "";
35
+
36
+ output = "<ul>\n"
36
37
  resources.each do |resource|
37
38
  # Skip from page tree if hide_in_navigation:true frontmatter
38
39
  next if resource.data.hide_in_navigation
@@ -63,9 +64,9 @@ module GovukTechDocs
63
64
  end
64
65
 
65
66
  if resource.children.any? && resource.url != home_url
66
- output += %{<ul><li><a href="#{resource.url}"><span>#{resource.data.title}</span></a>\n}
67
+ output += %{<li><a href="#{resource.url}"><span>#{resource.data.title}</span></a>\n}
67
68
  output += render_page_tree(resource.children, current_page, config, current_page_html)
68
- output += "</li></ul>"
69
+ output += "</li>\n"
69
70
  else
70
71
  output +=
71
72
  single_page_table_of_contents(
@@ -75,6 +76,8 @@ module GovukTechDocs
75
76
  )
76
77
  end
77
78
  end
79
+ output += "</ul>\n"
80
+
78
81
  output
79
82
  end
80
83
  end
@@ -16,7 +16,7 @@ module GovukTechDocs
16
16
 
17
17
  def header(text, level)
18
18
  anchor = UniqueIdentifierGenerator.instance.create(text, level)
19
- %(<h#{level} id="#{anchor}">#{text}</h#{level}>)
19
+ %(<h#{level} id="#{anchor}">#{text}</h#{level}>\n)
20
20
  end
21
21
 
22
22
  def image(link, *args)
@@ -1,3 +1,3 @@
1
1
  module GovukTechDocs
2
- VERSION = "2.3.0".freeze
2
+ VERSION = "2.4.0".freeze
3
3
  end
@@ -8,12 +8,13 @@
8
8
  <% end %>
9
9
  <% if config[:tech_docs][:show_govuk_logo] %>
10
10
  <span class="govuk-header__logotype">
11
+ <!--[if gt IE 8]><!-->
11
12
  <svg
12
13
  aria-hidden="true"
13
14
  focusable="false"
14
15
  class="govuk-header__logotype-crown"
15
16
  xmlns="http://www.w3.org/2000/svg"
16
- viewbox="0 0 132 97"
17
+ viewBox="0 0 132 97"
17
18
  height="30"
18
19
  width="36"
19
20
  >
@@ -21,8 +22,11 @@
21
22
  fill="currentColor" fill-rule="evenodd"
22
23
  d="M25 30.2c3.5 1.5 7.7-.2 9.1-3.7 1.5-3.6-.2-7.8-3.9-9.2-3.6-1.4-7.6.3-9.1 3.9-1.4 3.5.3 7.5 3.9 9zM9 39.5c3.6 1.5 7.8-.2 9.2-3.7 1.5-3.6-.2-7.8-3.9-9.1-3.6-1.5-7.6.2-9.1 3.8-1.4 3.5.3 7.5 3.8 9zM4.4 57.2c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.5-1.5-7.6.3-9.1 3.8-1.4 3.5.3 7.6 3.9 9.1zm38.3-21.4c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.6-1.5-7.6.3-9.1 3.8-1.3 3.6.4 7.7 3.9 9.1zm64.4-5.6c-3.6 1.5-7.8-.2-9.1-3.7-1.5-3.6.2-7.8 3.8-9.2 3.6-1.4 7.7.3 9.2 3.9 1.3 3.5-.4 7.5-3.9 9zm15.9 9.3c-3.6 1.5-7.7-.2-9.1-3.7-1.5-3.6.2-7.8 3.7-9.1 3.6-1.5 7.7.2 9.2 3.8 1.5 3.5-.3 7.5-3.8 9zm4.7 17.7c-3.6 1.5-7.8-.2-9.2-3.8-1.5-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.3 3.5-.4 7.6-3.9 9.1zM89.3 35.8c-3.6 1.5-7.8-.2-9.2-3.8-1.4-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.4 3.6-.3 7.7-3.9 9.1zM69.7 17.7l8.9 4.7V9.3l-8.9 2.8c-.2-.3-.5-.6-.9-.9L72.4 0H59.6l3.5 11.2c-.3.3-.6.5-.9.9l-8.8-2.8v13.1l8.8-4.7c.3.3.6.7.9.9l-5 15.4v.1c-.2.8-.4 1.6-.4 2.4 0 4.1 3.1 7.5 7 8.1h.2c.3 0 .7.1 1 .1.4 0 .7 0 1-.1h.2c4-.6 7.1-4.1 7.1-8.1 0-.8-.1-1.7-.4-2.4V34l-5.1-15.4c.4-.2.7-.6 1-.9zM66 92.8c16.9 0 32.8 1.1 47.1 3.2 4-16.9 8.9-26.7 14-33.5l-9.6-3.4c1 4.9 1.1 7.2 0 10.2-1.5-1.4-3-4.3-4.2-8.7L108.6 76c2.8-2 5-3.2 7.5-3.3-4.4 9.4-10 11.9-13.6 11.2-4.3-.8-6.3-4.6-5.6-7.9 1-4.7 5.7-5.9 8-.5 4.3-8.7-3-11.4-7.6-8.8 7.1-7.2 7.9-13.5 2.1-21.1-8 6.1-8.1 12.3-4.5 20.8-4.7-5.4-12.1-2.5-9.5 6.2 3.4-5.2 7.9-2 7.2 3.1-.6 4.3-6.4 7.8-13.5 7.2-10.3-.9-10.9-8-11.2-13.8 2.5-.5 7.1 1.8 11 7.3L80.2 60c-4.1 4.4-8 5.3-12.3 5.4 1.4-4.4 8-11.6 8-11.6H55.5s6.4 7.2 7.9 11.6c-4.2-.1-8-1-12.3-5.4l1.4 16.4c3.9-5.5 8.5-7.7 10.9-7.3-.3 5.8-.9 12.8-11.1 13.8-7.2.6-12.9-2.9-13.5-7.2-.7-5 3.8-8.3 7.1-3.1 2.7-8.7-4.6-11.6-9.4-6.2 3.7-8.5 3.6-14.7-4.6-20.8-5.8 7.6-5 13.9 2.2 21.1-4.7-2.6-11.9.1-7.7 8.8 2.3-5.5 7.1-4.2 8.1.5.7 3.3-1.3 7.1-5.7 7.9-3.5.7-9-1.8-13.5-11.2 2.5.1 4.7 1.3 7.5 3.3l-4.7-15.4c-1.2 4.4-2.7 7.2-4.3 8.7-1.1-3-.9-5.3 0-10.2l-9.5 3.4c5 6.9 9.9 16.7 14 33.5 14.8-2.1 30.8-3.2 47.7-3.2z"
23
24
  ></path>
24
- <image src="/assets/images/govuk-logotype-crown.png" xlink:href="" class="govuk-header__logotype-crown-fallback-image" width="36" height="32"></image>
25
25
  </svg>
26
+ <!--<![endif]-->
27
+ <!--[if IE 8]>
28
+ <img src="/assets/images/govuk-logotype-crown.png" class="govuk-header__logotype-crown-fallback-image" width="36" height="32">
29
+ <![endif]-->
26
30
  <span class="govuk-header__logotype-text">
27
31
  GOV.UK
28
32
  </span>
@@ -1751,6 +1751,47 @@ Checkboxes.prototype.syncConditionalRevealWithInputState = function ($input) {
1751
1751
  }
1752
1752
  };
1753
1753
 
1754
+ /**
1755
+ * Uncheck other checkboxes
1756
+ *
1757
+ * Find any other checkbox inputs with the same name value, and uncheck them.
1758
+ * This is useful for when a “None of these" checkbox is checked.
1759
+ */
1760
+ Checkboxes.prototype.unCheckAllInputsExcept = function ($input) {
1761
+ var allInputsWithSameName = document.querySelectorAll('input[type="checkbox"][name="' + $input.name + '"]');
1762
+
1763
+ nodeListForEach(allInputsWithSameName, function ($inputWithSameName) {
1764
+ var hasSameFormOwner = ($input.form === $inputWithSameName.form);
1765
+ if (hasSameFormOwner && $inputWithSameName !== $input) {
1766
+ $inputWithSameName.checked = false;
1767
+ }
1768
+ });
1769
+
1770
+ this.syncAllConditionalReveals();
1771
+ };
1772
+
1773
+ /**
1774
+ * Uncheck exclusive inputs
1775
+ *
1776
+ * Find any checkbox inputs with the same name value and the 'exclusive' behaviour,
1777
+ * and uncheck them. This helps prevent someone checking both a regular checkbox and a
1778
+ * "None of these" checkbox in the same fieldset.
1779
+ */
1780
+ Checkboxes.prototype.unCheckExclusiveInputs = function ($input) {
1781
+ var allInputsWithSameNameAndExclusiveBehaviour = document.querySelectorAll(
1782
+ 'input[data-behaviour="exclusive"][type="checkbox"][name="' + $input.name + '"]'
1783
+ );
1784
+
1785
+ nodeListForEach(allInputsWithSameNameAndExclusiveBehaviour, function ($exclusiveInput) {
1786
+ var hasSameFormOwner = ($input.form === $exclusiveInput.form);
1787
+ if (hasSameFormOwner) {
1788
+ $exclusiveInput.checked = false;
1789
+ }
1790
+ });
1791
+
1792
+ this.syncAllConditionalReveals();
1793
+ };
1794
+
1754
1795
  /**
1755
1796
  * Click event handler
1756
1797
  *
@@ -1762,12 +1803,29 @@ Checkboxes.prototype.syncConditionalRevealWithInputState = function ($input) {
1762
1803
  Checkboxes.prototype.handleClick = function (event) {
1763
1804
  var $target = event.target;
1764
1805
 
1765
- // If a checkbox with aria-controls, handle click
1766
- var isCheckbox = $target.getAttribute('type') === 'checkbox';
1806
+ // Ignore clicks on things that aren't checkbox inputs
1807
+ if ($target.type !== 'checkbox') {
1808
+ return
1809
+ }
1810
+
1811
+ // If the checkbox conditionally-reveals some content, sync the state
1767
1812
  var hasAriaControls = $target.getAttribute('aria-controls');
1768
- if (isCheckbox && hasAriaControls) {
1813
+ if (hasAriaControls) {
1769
1814
  this.syncConditionalRevealWithInputState($target);
1770
1815
  }
1816
+
1817
+ // No further behaviour needed for unchecking
1818
+ if (!$target.checked) {
1819
+ return
1820
+ }
1821
+
1822
+ // Handle 'exclusive' checkbox behaviour (ie "None of these")
1823
+ var hasBehaviourExclusive = ($target.getAttribute('data-behaviour') === 'exclusive');
1824
+ if (hasBehaviourExclusive) {
1825
+ this.unCheckAllInputsExcept($target);
1826
+ } else {
1827
+ this.unCheckExclusiveInputs($target);
1828
+ }
1771
1829
  };
1772
1830
 
1773
1831
  (function(undefined) {
@@ -129,6 +129,7 @@
129
129
 
130
130
  .govuk-breadcrumbs__list {
131
131
  display: -webkit-box;
132
+ display: -webkit-flex;
132
133
  display: -ms-flexbox;
133
134
  display: flex;
134
135
  }
@@ -241,6 +241,8 @@
241
241
 
242
242
  display: -webkit-inline-box;
243
243
 
244
+ display: -webkit-inline-flex;
245
+
244
246
  display: -ms-inline-flexbox;
245
247
 
246
248
  display: inline-flex;
@@ -248,6 +250,8 @@
248
250
 
249
251
  -webkit-box-pack: center;
250
252
 
253
+ -webkit-justify-content: center;
254
+
251
255
  -ms-flex-pack: center;
252
256
 
253
257
  justify-content: center;
@@ -260,10 +264,12 @@
260
264
  margin-left: govuk-spacing(2);
261
265
  }
262
266
  vertical-align: middle;
263
- -ms-flex-negative: 0;
264
- flex-shrink: 0;
265
- -ms-flex-item-align: center;
266
- align-self: center;
267
+ -webkit-flex-shrink: 0;
268
+ -ms-flex-negative: 0;
269
+ flex-shrink: 0;
270
+ -webkit-align-self: center;
271
+ -ms-flex-item-align: center;
272
+ align-self: center;
267
273
  }
268
274
 
269
275
  @if $govuk-use-legacy-font {
@@ -73,47 +73,49 @@
73
73
  touch-action: manipulation;
74
74
  }
75
75
 
76
- // [ ] Check box
77
- .govuk-checkboxes__label:before {
78
- content: "";
79
- box-sizing: border-box;
80
- position: absolute;
81
- top: 0;
82
- left: 0;
83
- width: $govuk-checkboxes-size;
84
- height: $govuk-checkboxes-size;
85
- border: $govuk-border-width-form-element solid currentColor;
86
- background: transparent;
87
- }
76
+ @include govuk-not-ie8 {
77
+ // [ ] Check box
78
+ .govuk-checkboxes__label:before {
79
+ content: "";
80
+ box-sizing: border-box;
81
+ position: absolute;
82
+ top: 0;
83
+ left: 0;
84
+ width: $govuk-checkboxes-size;
85
+ height: $govuk-checkboxes-size;
86
+ border: $govuk-border-width-form-element solid currentColor;
87
+ background: transparent;
88
+ }
88
89
 
89
- // ✔ Check mark
90
- //
91
- // The check mark is a box with a border on the left and bottom side (└──),
92
- // rotated 45 degrees
93
- .govuk-checkboxes__label:after {
94
- content: "";
95
- box-sizing: border-box;
90
+ // ✔ Check mark
91
+ //
92
+ // The check mark is a box with a border on the left and bottom side (└──),
93
+ // rotated 45 degrees
94
+ .govuk-checkboxes__label:after {
95
+ content: "";
96
+ box-sizing: border-box;
96
97
 
97
- position: absolute;
98
- top: 11px;
99
- left: 9px;
100
- width: 23px;
101
- height: 12px;
98
+ position: absolute;
99
+ top: 11px;
100
+ left: 9px;
101
+ width: 23px;
102
+ height: 12px;
102
103
 
103
- -webkit-transform: rotate(-45deg);
104
+ -webkit-transform: rotate(-45deg);
104
105
 
105
- -ms-transform: rotate(-45deg);
106
+ -ms-transform: rotate(-45deg);
106
107
 
107
- transform: rotate(-45deg);
108
- border: solid;
109
- border-width: 0 0 5px 5px;
110
- // Fix bug in IE11 caused by transform rotate (-45deg).
111
- // See: alphagov/govuk_elements/issues/518
112
- border-top-color: transparent;
108
+ transform: rotate(-45deg);
109
+ border: solid;
110
+ border-width: 0 0 5px 5px;
111
+ // Fix bug in IE11 caused by transform rotate (-45deg).
112
+ // See: alphagov/govuk_elements/issues/518
113
+ border-top-color: transparent;
113
114
 
114
- opacity: 0;
115
+ opacity: 0;
115
116
 
116
- background: transparent;
117
+ background: transparent;
118
+ }
117
119
  }
118
120
 
119
121
  .govuk-checkboxes__hint {
@@ -143,6 +145,19 @@
143
145
  opacity: .5;
144
146
  }
145
147
 
148
+ // =========================================================
149
+ // Dividers ('or')
150
+ // =========================================================
151
+
152
+ .govuk-checkboxes__divider {
153
+ $govuk-divider-size: $govuk-checkboxes-size !default;
154
+ @include govuk-font($size: 19);
155
+ @include govuk-text-colour;
156
+ width: $govuk-divider-size;
157
+ margin-bottom: govuk-spacing(2);
158
+ text-align: center;
159
+ }
160
+
146
161
  // =========================================================
147
162
  // Conditional reveals
148
163
  // =========================================================
@@ -1110,6 +1110,47 @@ Checkboxes.prototype.syncConditionalRevealWithInputState = function ($input) {
1110
1110
  }
1111
1111
  };
1112
1112
 
1113
+ /**
1114
+ * Uncheck other checkboxes
1115
+ *
1116
+ * Find any other checkbox inputs with the same name value, and uncheck them.
1117
+ * This is useful for when a “None of these" checkbox is checked.
1118
+ */
1119
+ Checkboxes.prototype.unCheckAllInputsExcept = function ($input) {
1120
+ var allInputsWithSameName = document.querySelectorAll('input[type="checkbox"][name="' + $input.name + '"]');
1121
+
1122
+ nodeListForEach(allInputsWithSameName, function ($inputWithSameName) {
1123
+ var hasSameFormOwner = ($input.form === $inputWithSameName.form);
1124
+ if (hasSameFormOwner && $inputWithSameName !== $input) {
1125
+ $inputWithSameName.checked = false;
1126
+ }
1127
+ });
1128
+
1129
+ this.syncAllConditionalReveals();
1130
+ };
1131
+
1132
+ /**
1133
+ * Uncheck exclusive inputs
1134
+ *
1135
+ * Find any checkbox inputs with the same name value and the 'exclusive' behaviour,
1136
+ * and uncheck them. This helps prevent someone checking both a regular checkbox and a
1137
+ * "None of these" checkbox in the same fieldset.
1138
+ */
1139
+ Checkboxes.prototype.unCheckExclusiveInputs = function ($input) {
1140
+ var allInputsWithSameNameAndExclusiveBehaviour = document.querySelectorAll(
1141
+ 'input[data-behaviour="exclusive"][type="checkbox"][name="' + $input.name + '"]'
1142
+ );
1143
+
1144
+ nodeListForEach(allInputsWithSameNameAndExclusiveBehaviour, function ($exclusiveInput) {
1145
+ var hasSameFormOwner = ($input.form === $exclusiveInput.form);
1146
+ if (hasSameFormOwner) {
1147
+ $exclusiveInput.checked = false;
1148
+ }
1149
+ });
1150
+
1151
+ this.syncAllConditionalReveals();
1152
+ };
1153
+
1113
1154
  /**
1114
1155
  * Click event handler
1115
1156
  *
@@ -1121,12 +1162,29 @@ Checkboxes.prototype.syncConditionalRevealWithInputState = function ($input) {
1121
1162
  Checkboxes.prototype.handleClick = function (event) {
1122
1163
  var $target = event.target;
1123
1164
 
1124
- // If a checkbox with aria-controls, handle click
1125
- var isCheckbox = $target.getAttribute('type') === 'checkbox';
1165
+ // Ignore clicks on things that aren't checkbox inputs
1166
+ if ($target.type !== 'checkbox') {
1167
+ return
1168
+ }
1169
+
1170
+ // If the checkbox conditionally-reveals some content, sync the state
1126
1171
  var hasAriaControls = $target.getAttribute('aria-controls');
1127
- if (isCheckbox && hasAriaControls) {
1172
+ if (hasAriaControls) {
1128
1173
  this.syncConditionalRevealWithInputState($target);
1129
1174
  }
1175
+
1176
+ // No further behaviour needed for unchecking
1177
+ if (!$target.checked) {
1178
+ return
1179
+ }
1180
+
1181
+ // Handle 'exclusive' checkbox behaviour (ie "None of these")
1182
+ var hasBehaviourExclusive = ($target.getAttribute('data-behaviour') === 'exclusive');
1183
+ if (hasBehaviourExclusive) {
1184
+ this.unCheckAllInputsExcept($target);
1185
+ } else {
1186
+ this.unCheckExclusiveInputs($target);
1187
+ }
1130
1188
  };
1131
1189
 
1132
1190
  return Checkboxes;
@@ -68,16 +68,20 @@
68
68
 
69
69
  .govuk-footer__meta {
70
70
  display: -webkit-box;
71
+ display: -webkit-flex;
71
72
  display: -ms-flexbox;
72
73
  display: flex; // Support: Flexbox
73
74
  margin-right: -$govuk-gutter-half;
74
75
  margin-left: -$govuk-gutter-half;
75
- -ms-flex-wrap: wrap;
76
- flex-wrap: wrap; // Support: Flexbox
76
+ -webkit-flex-wrap: wrap;
77
+ -ms-flex-wrap: wrap;
78
+ flex-wrap: wrap; // Support: Flexbox
77
79
  -webkit-box-align: end;
80
+ -webkit-align-items: flex-end;
78
81
  -ms-flex-align: end;
79
82
  align-items: flex-end; // Support: Flexbox
80
83
  -webkit-box-pack: center;
84
+ -webkit-justify-content: center;
81
85
  -ms-flex-pack: center;
82
86
  justify-content: center; // Support: Flexbox
83
87
  }
@@ -90,11 +94,13 @@
90
94
 
91
95
  .govuk-footer__meta-item--grow {
92
96
  -webkit-box-flex: 1;
97
+ -webkit-flex: 1;
93
98
  -ms-flex: 1;
94
99
  flex: 1; // Support: Flexbox
95
100
  @include govuk-media-query ($until: tablet) {
96
- -ms-flex-preferred-size: 320px;
97
- flex-basis: 320px; // Support: Flexbox
101
+ -webkit-flex-basis: 320px;
102
+ -ms-flex-preferred-size: 320px;
103
+ flex-basis: 320px; // Support: Flexbox
98
104
  }
99
105
  }
100
106
 
@@ -153,12 +159,14 @@
153
159
 
154
160
  .govuk-footer__navigation {
155
161
  display: -webkit-box;
162
+ display: -webkit-flex;
156
163
  display: -ms-flexbox;
157
164
  display: flex; // Support: Flexbox
158
165
  margin-right: -$govuk-gutter-half;
159
166
  margin-left: -$govuk-gutter-half;
160
- -ms-flex-wrap: wrap;
161
- flex-wrap: wrap; // Support: Flexbox
167
+ -webkit-flex-wrap: wrap;
168
+ -ms-flex-wrap: wrap;
169
+ flex-wrap: wrap; // Support: Flexbox
162
170
  }
163
171
 
164
172
  .govuk-footer__section {
@@ -169,15 +177,18 @@
169
177
  vertical-align: top;
170
178
  // Ensure columns take up equal width (typically one-half:one-half)
171
179
  -webkit-box-flex: 1;
180
+ -webkit-flex-grow: 1;
172
181
  -ms-flex-positive: 1;
173
182
  flex-grow: 1; // Support: Flexbox
174
- -ms-flex-negative: 1;
175
- flex-shrink: 1; // Support: Flexbox
183
+ -webkit-flex-shrink: 1;
184
+ -ms-flex-negative: 1;
185
+ flex-shrink: 1; // Support: Flexbox
176
186
  @include govuk-media-query ($until: desktop) {
177
187
  // Make sure columns do not drop below 200px in width
178
188
  // Will typically result in wrapping, and end up in a single column on smaller screens.
179
- -ms-flex-preferred-size: 200px;
180
- flex-basis: 200px; // Support: Flexbox
189
+ -webkit-flex-basis: 200px;
190
+ -ms-flex-preferred-size: 200px;
191
+ flex-basis: 200px; // Support: Flexbox
181
192
  }
182
193
  }
183
194
 
@@ -187,6 +198,7 @@
187
198
  // To ensure the section is one of two, we can count backwards using `:nth-last-child(2)`.
188
199
  .govuk-footer__section:first-child:nth-last-child(2) {
189
200
  -webkit-box-flex: 2;
201
+ -webkit-flex-grow: 2;
190
202
  -ms-flex-positive: 2;
191
203
  flex-grow: 2; // Support: Flexbox
192
204
  }
@@ -36,15 +36,19 @@
36
36
  .govuk-header__logotype {
37
37
  display: inline-block;
38
38
 
39
- // Add a gap between logo and any product name
39
+ // Add a gap after the logo in case it's followed by a product name. This
40
+ // gets removed later if the logotype is a :last-child.
40
41
  margin-right: govuk-spacing(1);
41
42
 
42
- // Prevent readability backplate from obscuring underline in Windows
43
- // High Contrast Mode
44
- forced-color-adjust: none;
43
+ // Prevent readability backplate from obscuring underline in Windows High
44
+ // Contrast Mode
45
+ @media (forced-colors: active) {
46
+ forced-color-adjust: none;
47
+ color: linktext;
48
+ }
45
49
 
46
- // But remove it if there's nothing after the logo to keep hover and focus
47
- // states neat
50
+ // Remove the gap after the logo if there's no product name to keep hover
51
+ // and focus states neat
48
52
  &:last-child {
49
53
  margin-right: 0;
50
54
  }
@@ -62,7 +66,7 @@
62
66
  width: 36px;
63
67
  height: 32px;
64
68
  border: 0;
65
- vertical-align: middle;
69
+ vertical-align: bottom;
66
70
  }
67
71
 
68
72
  .govuk-header__product-name {
@@ -95,11 +95,13 @@
95
95
 
96
96
  .govuk-input__wrapper {
97
97
  display: -webkit-box;
98
+ display: -webkit-flex;
98
99
  display: -ms-flexbox;
99
100
  display: flex;
100
101
 
101
102
  .govuk-input {
102
103
  -webkit-box-flex: 0;
104
+ -webkit-flex: 0 1 auto;
103
105
  -ms-flex: 0 1 auto;
104
106
  flex: 0 1 auto;
105
107
  }
@@ -150,6 +152,8 @@
150
152
 
151
153
  -webkit-box-flex: 0;
152
154
 
155
+ -webkit-flex: 0 0 auto;
156
+
153
157
  -ms-flex: 0 0 auto;
154
158
 
155
159
  flex: 0 0 auto;
@@ -11,7 +11,9 @@
11
11
 
12
12
  // Respect 'display cutout' safe area (avoids notches and rounded corners)
13
13
  @supports (padding: unquote("max(calc(0px))")) {
14
+ $padding-safe-area-right: -webkit-calc(#{govuk-spacing(3)} + env(safe-area-inset-right));
14
15
  $padding-safe-area-right: calc(#{govuk-spacing(3)} + env(safe-area-inset-right));
16
+ $padding-safe-area-left: -webkit-calc(#{govuk-spacing(3)} + env(safe-area-inset-left));
15
17
  $padding-safe-area-left: calc(#{govuk-spacing(3)} + env(safe-area-inset-left));
16
18
 
17
19
  // Use max() to pick largest padding, default or with safe area
@@ -43,7 +43,6 @@
43
43
  // Prevent the exclamation mark from being included when the warning text
44
44
  // is copied, for example.
45
45
  -webkit-user-select: none;
46
- -moz-user-select: none;
47
46
  -ms-user-select: none;
48
47
  user-select: none;
49
48
 
@@ -15,7 +15,6 @@
15
15
  // Prevent automatic text sizing, as we already cater for small devices and
16
16
  // would like the browser to stay on 100% text zoom by default.
17
17
  -webkit-text-size-adjust: 100%;
18
- -moz-text-size-adjust: 100%;
19
18
  -ms-text-size-adjust: 100%;
20
19
  text-size-adjust: 100%;
21
20
 
@@ -52,6 +52,12 @@
52
52
  @mixin govuk-link-hover-decoration {
53
53
  @if ($govuk-new-link-styles and $govuk-link-hover-underline-thickness) {
54
54
  text-decoration-thickness: $govuk-link-hover-underline-thickness;
55
+ // Disable ink skipping on underlines on hover. Browsers haven't
56
+ // standardised on this part of the spec yet, so set both properties
57
+ -webkit-text-decoration-skip-ink: none;
58
+ text-decoration-skip-ink: none; // Chromium, Firefox
59
+ -webkit-text-decoration-skip: none;
60
+ text-decoration-skip: none; // Safari
55
61
  }
56
62
  }
57
63
 
@@ -30,13 +30,16 @@
30
30
  // doesn't play nicely with it
31
31
  // (https://github.com/w3c/csswg-drafts/issues/3559)
32
32
  display: -webkit-box;
33
+ display: -webkit-flex;
33
34
  display: -ms-flexbox;
34
35
  display: flex;
35
36
  -webkit-box-orient: vertical;
36
37
  -webkit-box-direction: normal;
38
+ -webkit-flex-direction: column;
37
39
  -ms-flex-direction: column;
38
40
  flex-direction: column;
39
41
  -webkit-box-align: center;
42
+ -webkit-align-items: center;
40
43
  -ms-flex-align: center;
41
44
  align-items: center;
42
45
 
@@ -72,12 +75,16 @@
72
75
 
73
76
  -webkit-box-direction: normal;
74
77
 
78
+ -webkit-flex-direction: row;
79
+
75
80
  -ms-flex-direction: row;
76
81
 
77
82
  flex-direction: row;
78
- -ms-flex-wrap: wrap;
79
- flex-wrap: wrap;
83
+ -webkit-flex-wrap: wrap;
84
+ -ms-flex-wrap: wrap;
85
+ flex-wrap: wrap;
80
86
  -webkit-box-align: baseline;
87
+ -webkit-align-items: baseline;
81
88
  -ms-flex-align: baseline;
82
89
  align-items: baseline;
83
90
 
@@ -28,7 +28,9 @@
28
28
 
29
29
  // Respect 'display cutout' safe area (avoids notches and rounded corners)
30
30
  @supports (margin: unquote("max(calc(0px))")) {
31
+ $gutter-safe-area-right: -webkit-calc(#{$govuk-gutter-half} + env(safe-area-inset-right));
31
32
  $gutter-safe-area-right: calc(#{$govuk-gutter-half} + env(safe-area-inset-right));
33
+ $gutter-safe-area-left: -webkit-calc(#{$govuk-gutter-half} + env(safe-area-inset-left));
32
34
  $gutter-safe-area-left: calc(#{$govuk-gutter-half} + env(safe-area-inset-left));
33
35
 
34
36
  // Use max() to pick largest margin, default or with safe area
@@ -44,7 +46,9 @@
44
46
 
45
47
  // Respect 'display cutout' safe area (avoids notches and rounded corners)
46
48
  @supports (margin: unquote("max(calc(0px))")) {
49
+ $gutter-safe-area-right: -webkit-calc(#{$govuk-gutter-half} + env(safe-area-inset-right));
47
50
  $gutter-safe-area-right: calc(#{$govuk-gutter-half} + env(safe-area-inset-right));
51
+ $gutter-safe-area-left: -webkit-calc(#{$govuk-gutter-half} + env(safe-area-inset-left));
48
52
  $gutter-safe-area-left: calc(#{$govuk-gutter-half} + env(safe-area-inset-left));
49
53
 
50
54
  // Use max() to pick largest margin, default or with safe area
data/package-lock.json CHANGED
@@ -808,9 +808,9 @@
808
808
  }
809
809
  },
810
810
  "govuk-frontend": {
811
- "version": "3.12.0",
812
- "resolved": "https://registry.npmjs.org/govuk-frontend/-/govuk-frontend-3.12.0.tgz",
813
- "integrity": "sha512-+mM8BqEUqsBVSV/ud0dEhE8OmMdhkK53eEUp5YyPN+y3mwcdRnwwP2A2B5qFdFi6E6j/2AYuCG8l5kXD+JXNxA=="
811
+ "version": "3.13.0",
812
+ "resolved": "https://registry.npmjs.org/govuk-frontend/-/govuk-frontend-3.13.0.tgz",
813
+ "integrity": "sha512-JiPCeasuHZ+9m1VyqhsfE81PhWIW4Sweoe6Jvn6oMjQNr75ZpupiytN3DGwA+WKOoESHZibIG+heAzlkdZ/MhA=="
814
814
  },
815
815
  "graceful-fs": {
816
816
  "version": "4.2.6",
data/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "lint": "standard"
7
7
  },
8
8
  "dependencies": {
9
- "govuk-frontend": "^3.12.0"
9
+ "govuk-frontend": "^3.13.0"
10
10
  },
11
11
  "devDependencies": {
12
12
  "standard": "^14.3.4"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_tech_docs
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Government Digital Service
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-18 00:00:00.000000000 Z
11
+ date: 2021-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: autoprefixer-rails
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 3.5.0
173
+ version: 3.5.1
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 3.5.0
180
+ version: 3.5.1
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: byebug
183
183
  requirement: !ruby/object:Gem::Requirement