govuk_tech_docs 2.3.0 → 2.4.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of govuk_tech_docs might be problematic. Click here for more details.

Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.nvmrc +1 -1
  4. data/CHANGELOG.md +25 -0
  5. data/README.md +15 -1
  6. data/example/config/tech-docs.yml +1 -0
  7. data/example/source/single-page-nav.html.md +13 -0
  8. data/govuk_tech_docs.gemspec +1 -1
  9. data/lib/assets/javascripts/_modules/collapsible-navigation.js +7 -7
  10. data/lib/assets/javascripts/_modules/in-page-navigation.js +2 -4
  11. data/lib/assets/javascripts/_vendor/jquery.js +2 -5
  12. data/lib/assets/javascripts/_vendor/lodash.js +5 -3
  13. data/lib/assets/stylesheets/modules/_search.scss +1 -10
  14. data/lib/assets/stylesheets/modules/_technical-documentation.scss +1 -1
  15. data/lib/govuk_tech_docs/table_of_contents/heading.rb +5 -1
  16. data/lib/govuk_tech_docs/table_of_contents/heading_tree_renderer.rb +2 -2
  17. data/lib/govuk_tech_docs/table_of_contents/helpers.rb +22 -11
  18. data/lib/govuk_tech_docs/tech_docs_html_renderer.rb +1 -1
  19. data/lib/govuk_tech_docs/version.rb +1 -1
  20. data/lib/govuk_tech_docs.rb +1 -1
  21. data/lib/source/layouts/_header.erb +1 -2
  22. data/lib/source/layouts/layout.erb +3 -1
  23. data/node_modules/govuk-frontend/govuk/all.js +61 -3
  24. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_index.scss +1 -0
  25. data/node_modules/govuk-frontend/govuk/components/button/_index.scss +10 -4
  26. data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +49 -34
  27. data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +61 -3
  28. data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +22 -10
  29. data/node_modules/govuk-frontend/govuk/components/header/_index.scss +11 -7
  30. data/node_modules/govuk-frontend/govuk/components/input/_index.scss +4 -0
  31. data/node_modules/govuk-frontend/govuk/components/skip-link/_index.scss +2 -0
  32. data/node_modules/govuk-frontend/govuk/components/warning-text/_index.scss +0 -1
  33. data/node_modules/govuk-frontend/govuk/core/_template.scss +0 -1
  34. data/node_modules/govuk-frontend/govuk/helpers/_links.scss +6 -0
  35. data/node_modules/govuk-frontend/govuk/objects/_button-group.scss +9 -2
  36. data/node_modules/govuk-frontend/govuk/objects/_width-container.scss +4 -0
  37. data/package-lock.json +3 -3
  38. data/package.json +1 -1
  39. metadata +5 -5
  40. data/CONTRIBUTING.md +0 -12
@@ -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