govuk_publishing_components 28.5.0 → 28.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/analytics/track-select-change.js +4 -3
  3. data/app/assets/javascripts/govuk_publishing_components/components/accordion.js +21 -291
  4. data/app/assets/javascripts/govuk_publishing_components/components/button.js +1 -1
  5. data/app/assets/javascripts/govuk_publishing_components/components/character-count.js +1 -1
  6. data/app/assets/javascripts/govuk_publishing_components/components/checkboxes.js +1 -1
  7. data/app/assets/javascripts/govuk_publishing_components/components/details.js +1 -1
  8. data/app/assets/javascripts/govuk_publishing_components/components/error-summary.js +1 -1
  9. data/app/assets/javascripts/govuk_publishing_components/components/layout-header.js +1 -1
  10. data/app/assets/javascripts/govuk_publishing_components/components/radio.js +1 -1
  11. data/app/assets/javascripts/govuk_publishing_components/components/skip-link.js +5 -0
  12. data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +40 -37
  13. data/app/assets/javascripts/govuk_publishing_components/components/tabs.js +1 -1
  14. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/barchart-enhancement.js +2 -1
  15. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/magna-charta.js +8 -10
  16. data/app/assets/javascripts/govuk_publishing_components/lib/initial-focus.js +4 -3
  17. data/app/assets/javascripts/govuk_publishing_components/lib/toggle-input-class-on-focus.js +4 -3
  18. data/app/assets/javascripts/govuk_publishing_components/lib/toggle.js +4 -3
  19. data/app/assets/stylesheets/govuk_publishing_components/components/_accordion.scss +1 -329
  20. data/app/assets/stylesheets/govuk_publishing_components/components/_share-links.scss +1 -1
  21. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav.scss +95 -56
  22. data/app/assets/stylesheets/govuk_publishing_components/components/print/_accordion.scss +6 -17
  23. data/app/assets/stylesheets/govuk_publishing_components/govuk_frontend_support.scss +0 -9
  24. data/app/views/govuk_publishing_components/components/_accordion.html.erb +31 -16
  25. data/app/views/govuk_publishing_components/components/_button.html.erb +1 -1
  26. data/app/views/govuk_publishing_components/components/_character_count.html.erb +2 -2
  27. data/app/views/govuk_publishing_components/components/_checkboxes.html.erb +2 -2
  28. data/app/views/govuk_publishing_components/components/_error_message.html.erb +1 -1
  29. data/app/views/govuk_publishing_components/components/_error_summary.html.erb +0 -1
  30. data/app/views/govuk_publishing_components/components/_inset_text.html.erb +12 -1
  31. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +1 -1
  32. data/app/views/govuk_publishing_components/components/_modal_dialogue.html.erb +1 -1
  33. data/app/views/govuk_publishing_components/components/_radio.html.erb +1 -1
  34. data/app/views/govuk_publishing_components/components/_skip_link.html.erb +1 -1
  35. data/app/views/govuk_publishing_components/components/docs/accordion.yml +2 -97
  36. data/app/views/govuk_publishing_components/components/docs/govspeak.yml +1 -1
  37. data/app/views/govuk_publishing_components/components/docs/inset_text.yml +6 -0
  38. data/app/views/govuk_publishing_components/components/docs/share_links.yml +1 -1
  39. data/app/views/govuk_publishing_components/components/docs/step_by_step_nav.yml +13 -13
  40. data/app/views/govuk_publishing_components/components/docs/tabs.yml +1 -1
  41. data/app/views/govuk_publishing_components/components/docs/textarea.yml +1 -1
  42. data/app/views/govuk_publishing_components/components/layout_header/_navigation_items.html.erb +11 -11
  43. data/lib/govuk_publishing_components/version.rb +1 -1
  44. data/node_modules/govuk-frontend/govuk/all.js +294 -76
  45. data/node_modules/govuk-frontend/govuk/components/accordion/_index.scss +274 -99
  46. data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js +169 -65
  47. data/node_modules/govuk-frontend/govuk/components/accordion/fixtures.json +37 -5
  48. data/node_modules/govuk-frontend/govuk/components/accordion/macro-options.json +4 -4
  49. data/node_modules/govuk-frontend/govuk/components/button/button.js +2 -2
  50. data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +3 -3
  51. data/node_modules/govuk-frontend/govuk/components/character-count/fixtures.json +15 -2
  52. data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +8 -10
  53. data/node_modules/govuk-frontend/govuk/components/checkboxes/fixtures.json +52 -15
  54. data/node_modules/govuk-frontend/govuk/components/cookie-banner/_index.scss +0 -2
  55. data/node_modules/govuk-frontend/govuk/components/cookie-banner/fixtures.json +31 -0
  56. data/node_modules/govuk-frontend/govuk/components/date-input/fixtures.json +25 -25
  57. data/node_modules/govuk-frontend/govuk/components/details/details.js +2 -2
  58. data/node_modules/govuk-frontend/govuk/components/error-message/_index.scss +1 -0
  59. data/node_modules/govuk-frontend/govuk/components/error-message/fixtures.json +8 -8
  60. data/node_modules/govuk-frontend/govuk/components/error-message/template.njk +2 -2
  61. data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js +24 -3
  62. data/node_modules/govuk-frontend/govuk/components/error-summary/fixtures.json +25 -16
  63. data/node_modules/govuk-frontend/govuk/components/error-summary/macro-options.json +6 -0
  64. data/node_modules/govuk-frontend/govuk/components/error-summary/template.njk +2 -1
  65. data/node_modules/govuk-frontend/govuk/components/file-upload/fixtures.json +4 -4
  66. data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +3 -37
  67. data/node_modules/govuk-frontend/govuk/components/footer/fixtures.json +119 -15
  68. data/node_modules/govuk-frontend/govuk/components/footer/macro-options.json +6 -0
  69. data/node_modules/govuk-frontend/govuk/components/footer/template.njk +1 -1
  70. data/node_modules/govuk-frontend/govuk/components/header/_index.scss +10 -4
  71. data/node_modules/govuk-frontend/govuk/components/header/fixtures.json +11 -11
  72. data/node_modules/govuk-frontend/govuk/components/header/header.js +4 -4
  73. data/node_modules/govuk-frontend/govuk/components/header/template.njk +4 -3
  74. data/node_modules/govuk-frontend/govuk/components/hint/_index.scss +1 -3
  75. data/node_modules/govuk-frontend/govuk/components/input/_index.scss +1 -1
  76. data/node_modules/govuk-frontend/govuk/components/input/fixtures.json +40 -40
  77. data/node_modules/govuk-frontend/govuk/components/input/template.njk +4 -3
  78. data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js +499 -2
  79. data/node_modules/govuk-frontend/govuk/components/phase-banner/fixtures.json +2 -2
  80. data/node_modules/govuk-frontend/govuk/components/radios/_index.scss +0 -8
  81. data/node_modules/govuk-frontend/govuk/components/radios/fixtures.json +44 -45
  82. data/node_modules/govuk-frontend/govuk/components/radios/radios.js +4 -4
  83. data/node_modules/govuk-frontend/govuk/components/radios/template.njk +2 -9
  84. data/node_modules/govuk-frontend/govuk/components/select/_index.scss +6 -1
  85. data/node_modules/govuk-frontend/govuk/components/select/fixtures.json +3 -3
  86. data/node_modules/govuk-frontend/govuk/components/skip-link/_index.scss +13 -0
  87. data/node_modules/govuk-frontend/govuk/components/skip-link/fixtures.json +9 -9
  88. data/node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js +1108 -0
  89. data/node_modules/govuk-frontend/govuk/components/skip-link/template.njk +1 -1
  90. data/node_modules/govuk-frontend/govuk/components/summary-list/_index.scss +20 -23
  91. data/node_modules/govuk-frontend/govuk/components/summary-list/fixtures.json +86 -1
  92. data/node_modules/govuk-frontend/govuk/components/summary-list/template.njk +1 -4
  93. data/node_modules/govuk-frontend/govuk/components/tabs/_index.scss +2 -2
  94. data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js +2 -2
  95. data/node_modules/govuk-frontend/govuk/components/tag/_index.scss +0 -5
  96. data/node_modules/govuk-frontend/govuk/components/tag/fixtures.json +2 -2
  97. data/node_modules/govuk-frontend/govuk/components/textarea/_index.scss +1 -1
  98. data/node_modules/govuk-frontend/govuk/components/textarea/fixtures.json +4 -4
  99. data/node_modules/govuk-frontend/govuk/core/_all.scss +0 -1
  100. data/node_modules/govuk-frontend/govuk/core/_global-styles.scss +0 -6
  101. data/node_modules/govuk-frontend/govuk/core/_links.scss +0 -6
  102. data/node_modules/govuk-frontend/govuk/core/_lists.scss +0 -6
  103. data/node_modules/govuk-frontend/govuk/core/_section-break.scss +0 -6
  104. data/node_modules/govuk-frontend/govuk/core/_typography.scss +0 -6
  105. data/node_modules/govuk-frontend/govuk/objects/_all.scss +1 -0
  106. data/node_modules/govuk-frontend/govuk/objects/_main-wrapper.scss +15 -30
  107. data/node_modules/govuk-frontend/govuk/{core → objects}/_template.scss +1 -5
  108. data/node_modules/govuk-frontend/govuk/overrides/_display.scss +0 -6
  109. data/node_modules/govuk-frontend/govuk/overrides/_spacing.scss +0 -6
  110. data/node_modules/govuk-frontend/govuk/overrides/_text-align.scss +0 -6
  111. data/node_modules/govuk-frontend/govuk/overrides/_typography.scss +0 -6
  112. data/node_modules/govuk-frontend/govuk/overrides/_width.scss +0 -6
  113. data/node_modules/govuk-frontend/govuk/settings/_colours-organisations.scss +3 -0
  114. data/node_modules/govuk-frontend/govuk/settings/_measurements.scss +0 -10
  115. data/node_modules/govuk-frontend/govuk/tools/_all.scss +0 -1
  116. data/node_modules/govuk-frontend/package.json +1 -1
  117. metadata +8 -7
  118. data/node_modules/govuk-frontend/govuk/tools/_iff.scss +0 -17
@@ -1,38 +1,33 @@
1
1
  @include govuk-exports("govuk/component/accordion") {
2
+ $govuk-accordion-base-colour: govuk-colour("black");
3
+ $govuk-accordion-hover-colour: govuk-colour("light-grey", $legacy: "grey-3");
4
+ $govuk-accordion-icon-focus-colour: govuk-colour("yellow");
5
+ $govuk-accordion-bottom-border-width: 1px;
6
+
2
7
  .govuk-accordion {
3
8
  @include govuk-responsive-margin(6, "bottom");
4
9
  }
5
10
 
6
- // Borders between accordion sections
7
11
  .govuk-accordion__section {
8
12
  padding-top: govuk-spacing(3);
9
13
  }
10
14
 
11
- .govuk-accordion__section-header {
12
- padding-top: govuk-spacing(3);
13
- padding-bottom: govuk-spacing(3);
14
- }
15
-
16
15
  .govuk-accordion__section-heading {
17
16
  // Override browser defaults to ensure consistent element height
18
- // Font size is set in .govuk-accordion__section-button
19
- @include govuk-font(24);
17
+ margin-top: 0;
18
+ margin-bottom: 0;
20
19
 
21
- margin-top: 0; // Override browser default
22
- margin-bottom: 0; // Override browser default
20
+ padding-top: govuk-spacing(3);
21
+ padding-bottom: govuk-spacing(3);
23
22
  }
24
23
 
25
- // Buttons within the sections don’t need default styling
26
24
  .govuk-accordion__section-button {
27
25
  @include govuk-font($size: 24, $weight: bold);
28
- display: inline-block;
29
- margin-bottom: 0;
30
- padding-top: govuk-spacing(3);
31
- }
26
+ @include govuk-text-colour;
32
27
 
33
- .govuk-accordion__section-summary {
34
- margin-top: govuk-spacing(2);
28
+ display: block;
35
29
  margin-bottom: 0;
30
+ padding-top: govuk-spacing(3);
36
31
  }
37
32
 
38
33
  // Remove the bottom margin from the last item inside the content
@@ -44,10 +39,9 @@
44
39
  .js-enabled {
45
40
  .govuk-accordion {
46
41
  // Border at the bottom of the whole accordion
47
- border-bottom: 1px solid $govuk-border-colour;
42
+ border-bottom: $govuk-accordion-bottom-border-width solid $govuk-border-colour;
48
43
  }
49
44
 
50
- // Borders between accordion sections
51
45
  .govuk-accordion__section {
52
46
  padding-top: 0;
53
47
  }
@@ -55,8 +49,7 @@
55
49
  // Hide the body of collapsed sections
56
50
  .govuk-accordion__section-content {
57
51
  display: none;
58
- @include govuk-responsive-padding(3, "top");
59
- @include govuk-responsive-padding(3, "bottom");
52
+ @include govuk-responsive-padding(8, "bottom");
60
53
  }
61
54
 
62
55
  // Show the body of expanded sections
@@ -64,54 +57,209 @@
64
57
  display: block;
65
58
  }
66
59
 
67
- // This is styled to look like a link not a button
68
- .govuk-accordion__open-all {
69
- @include govuk-font($size: 16);
60
+ .govuk-accordion__show-all {
61
+ @include govuk-font($size: 19);
70
62
  position: relative;
71
63
  z-index: 1;
72
- margin: 0;
73
- padding: 0;
64
+
65
+ margin-bottom: 9px;
66
+ padding: govuk-spacing(1) 2px govuk-spacing(1) 0;
67
+
74
68
  border-width: 0;
69
+
75
70
  color: $govuk-link-colour;
76
71
  background: none;
72
+
77
73
  cursor: pointer;
78
74
  -webkit-appearance: none;
79
75
 
80
- @include govuk-link-common;
81
- @include govuk-link-style-default;
76
+ @include govuk-media-query ($from: desktop) {
77
+ margin-bottom: 14px;
78
+ }
82
79
 
83
80
  // Remove default button focus outline in Firefox
84
81
  &::-moz-focus-inner {
85
82
  padding: 0;
86
83
  border: 0;
87
84
  }
85
+
86
+ &:hover {
87
+ color: $govuk-accordion-base-colour;
88
+ background: $govuk-accordion-hover-colour;
89
+ // The GOV.UK Design System focus state adds a box-shadow to the top and bottom of the
90
+ // button. We add a grey box-shadow on hover too, to make the height of the hover state
91
+ // match the height of the focus state.
92
+ box-shadow: 0 -2px $govuk-accordion-hover-colour, 0 4px $govuk-accordion-hover-colour;
93
+
94
+ .govuk-accordion__section-toggle-text {
95
+ color: $govuk-accordion-base-colour;
96
+ }
97
+
98
+ .govuk-accordion-nav__chevron {
99
+ color: $govuk-accordion-base-colour;
100
+ background: $govuk-accordion-base-colour;
101
+ }
102
+
103
+ .govuk-accordion-nav__chevron:after {
104
+ color: $govuk-accordion-hover-colour;
105
+ }
106
+ }
107
+
108
+ &:focus {
109
+ @include govuk-focused-text;
110
+
111
+ .govuk-accordion-nav__chevron {
112
+ background: $govuk-accordion-base-colour;
113
+ }
114
+
115
+ .govuk-accordion-nav__chevron:after {
116
+ color: $govuk-accordion-icon-focus-colour;
117
+ }
118
+ }
119
+ }
120
+
121
+ .govuk-accordion__section-heading {
122
+ padding: 0;
88
123
  }
89
124
 
90
- // Section headers have a pointer cursor as an additional affordance
91
- .govuk-accordion__section-header {
125
+ // Create Chevron icon aligned with text
126
+ .govuk-accordion-nav__chevron {
127
+ box-sizing: border-box;
128
+ display: inline-block;
129
+
92
130
  position: relative;
93
- // Safe area on the right to avoid clashing with icon
94
- padding-right: 40px;
95
- border-top: 1px solid $govuk-border-colour;
96
- cursor: pointer;
131
+
132
+ // Set size using rems to make the icon scale with text if user resizes text in their browser
133
+ width: govuk-px-to-rem(20px);
134
+ height: govuk-px-to-rem(20px);
135
+
136
+ border: govuk-px-to-rem(1px) solid;
137
+ border-radius: 50%;
138
+
139
+ vertical-align: middle;
140
+
141
+ // IE8 fallback of icon
142
+ @include govuk-if-ie8 {
143
+ display: inline-block;
144
+ max-height: 20px;
145
+ line-height: 1;
146
+ }
147
+
148
+ // Create inner chevron arrow
149
+ &:after {
150
+ content: "";
151
+ box-sizing: border-box;
152
+ display: block;
153
+
154
+ position: absolute;
155
+ bottom: govuk-px-to-rem(5px);
156
+ left: govuk-px-to-rem(6px);
157
+
158
+ width: govuk-px-to-rem(6px);
159
+ height: govuk-px-to-rem(6px);
160
+
161
+ -webkit-transform: rotate(-45deg);
162
+
163
+ -ms-transform: rotate(-45deg);
164
+
165
+ transform: rotate(-45deg);
166
+
167
+ border-top: govuk-px-to-rem(2px) solid;
168
+ border-right: govuk-px-to-rem(2px) solid;
169
+
170
+ // IE8 fallback of icon with HTML symbol
171
+ @include govuk-if-ie8 {
172
+ content: "\25B2"; // "▲"
173
+ position: relative;
174
+ border: 0;
175
+ }
176
+ }
177
+ }
178
+
179
+ // Rotate icon to create "Down" version
180
+ .govuk-accordion-nav__chevron--down {
181
+ -webkit-transform: rotate(180deg);
182
+ -ms-transform: rotate(180deg);
183
+ transform: rotate(180deg);
184
+
185
+ // IE8 fallback of arrow icon
186
+ @include govuk-if-ie8 {
187
+ &:after {
188
+ content: "\25BC"; // "▼"
189
+ -webkit-transform: none;
190
+ -ms-transform: none;
191
+ transform: none;
192
+ }
193
+ }
97
194
  }
98
195
 
99
- // Buttons within the headers don’t need default styling
100
196
  .govuk-accordion__section-button {
101
- @include govuk-typography-common;
102
- margin-top: 0;
103
- margin-bottom: 0;
104
- margin-left: 0;
105
- padding: 0;
106
- border-width: 0;
107
- color: $govuk-link-colour;
197
+ width: 100%;
198
+
199
+ padding: govuk-spacing(2) 0 0 0;
200
+
201
+ border: 0;
202
+
203
+ border-top: $govuk-accordion-bottom-border-width solid $govuk-border-colour;
204
+
205
+ // Visually separate the section from the one underneath when user changes colours in their
206
+ // browser. See https://github.com/alphagov/govuk-frontend/issues/2321#issuecomment-924201488
207
+ border-bottom: govuk-spacing(2) solid transparent;
208
+
209
+ color: $govuk-text-colour;
108
210
  background: none;
211
+
109
212
  text-align: left;
213
+ // Section headers have a pointer cursor as an additional affordance
110
214
  cursor: pointer;
111
215
  -webkit-appearance: none;
112
216
 
217
+ @include govuk-media-query ($from: tablet) {
218
+ padding-bottom: govuk-spacing(2);
219
+ }
220
+
221
+ &:active {
222
+ color: $govuk-link-active-colour;
223
+ background: none;
224
+ }
225
+
226
+ &:hover {
227
+ color: $govuk-accordion-base-colour;
228
+ background: $govuk-accordion-hover-colour;
229
+
230
+ .govuk-accordion__section-toggle-text {
231
+ color: $govuk-accordion-base-colour;
232
+ }
233
+
234
+ .govuk-accordion-nav__chevron {
235
+ color: $govuk-accordion-base-colour;
236
+ background: $govuk-accordion-base-colour;
237
+ }
238
+
239
+ .govuk-accordion-nav__chevron:after {
240
+ color: $govuk-accordion-hover-colour;
241
+ }
242
+ }
243
+
113
244
  &:focus {
114
- @include govuk-focused-text;
245
+ // Remove default focus border around button as
246
+ // styling is being applied to inner text elements that receive focus
247
+ outline: 0;
248
+
249
+ .govuk-accordion__section-heading-text-focus,
250
+ .govuk-accordion__section-summary-focus,
251
+ .govuk-accordion__section-toggle-focus {
252
+ @include govuk-focused-text;
253
+ }
254
+
255
+ .govuk-accordion-nav__chevron {
256
+ color: $govuk-accordion-base-colour;
257
+ background: $govuk-accordion-base-colour;
258
+ }
259
+
260
+ .govuk-accordion-nav__chevron:after {
261
+ color: $govuk-accordion-icon-focus-colour;
262
+ }
115
263
  }
116
264
 
117
265
  // Remove default button focus outline in Firefox
@@ -121,77 +269,104 @@
121
269
  }
122
270
  }
123
271
 
124
- // Extend the touch area of the button to span the section header
125
- .govuk-accordion__section-button:after {
126
- content: "";
127
- position: absolute;
128
- top: 0;
129
- right: 0;
130
- bottom: 0;
131
- left: 0;
272
+ // Remove the transparent border when the section is expanded to make it clear that the heading
273
+ // relates to the content below. Adjust padding to maintain the height of the element.
274
+ // See https://github.com/alphagov/govuk-frontend/pull/2257#issuecomment-951920798
275
+ .govuk-accordion__section--expanded .govuk-accordion__section-button {
276
+ padding-bottom: govuk-spacing(4);
277
+ border-bottom: 0;
132
278
  }
133
279
 
134
- .govuk-accordion__section-button:hover:not(:focus) {
135
- color: $govuk-link-hover-colour;
136
- text-decoration: underline;
280
+ // As Chevron icon is vertically aligned it overlaps with the focus state bottom border
281
+ // Styling adds some spacing
282
+ .govuk-accordion__section-button:focus .govuk-accordion__section-toggle-focus {
283
+ padding-bottom: 3px;
137
284
 
138
- // This needs to come after the text-decoration property otherwise
139
- // text-decoration, as a shorthand property, resets it to auto
140
- @include govuk-link-hover-decoration;
141
- text-underline-offset: $govuk-link-underline-offset;
285
+ @include govuk-media-query ($from: desktop) {
286
+ padding-bottom: 2px;
287
+ }
142
288
  }
143
289
 
144
- // For devices that can't hover such as touch devices,
145
- // remove hover state as it can be stuck in that state (iOS).
146
- @media (hover: none) {
147
- .govuk-accordion__section-button:hover {
148
- text-decoration: none;
290
+ .govuk-accordion__section-toggle,
291
+ .govuk-accordion__section-heading-text,
292
+ .govuk-accordion__section-summary {
293
+ display: block;
294
+ margin-bottom: 13px;
295
+
296
+ .govuk-accordion__section-heading-text-focus,
297
+ .govuk-accordion__section-summary-focus,
298
+ .govuk-accordion__section-toggle-focus {
299
+ display: inline;
149
300
  }
150
301
  }
151
302
 
152
- .govuk-accordion__controls {
153
- text-align: right;
303
+ // Add toggle link with Chevron icon on left.
304
+ .govuk-accordion__section-toggle {
305
+ @include govuk-typography-responsive($size: 19);
306
+ @include govuk-typography-weight-regular;
307
+ color: $govuk-link-colour;
154
308
  }
155
309
 
156
- // Display an icon to the right of each header to indicate open/closed status,
157
- // and as an additional affordance.
158
- .govuk-accordion__icon {
159
- position: absolute;
160
- top: 50%;
161
- right: 15px;
162
- width: 16px;
163
- height: 16px;
164
- margin-top: -8px;
310
+ // Add space between the icon and text.
311
+ // Avoid applying spacing directly to the icon as the use of `transform` will change the
312
+ // placement of any margins.
313
+ .govuk-accordion__show-all-text,
314
+ .govuk-accordion__section-toggle-text {
315
+ margin-left: govuk-spacing(1);
316
+ vertical-align: middle;
165
317
  }
166
318
 
167
- .govuk-accordion__icon:after,
168
- .govuk-accordion__icon:before {
169
- content: "";
170
- box-sizing: border-box;
171
- position: absolute;
172
- top: 0;
173
- right: 0;
174
- bottom: 0;
175
- left: 0;
176
- width: 25%;
177
- height: 25%;
178
- margin: auto;
179
- border: 2px solid transparent;
180
- background-color: govuk-colour("black");
181
- }
182
-
183
- .govuk-accordion__icon:before {
184
- width: 100%;
185
- }
319
+ // Background colour adjustment when user changes colours in Firefox
320
+ //
321
+ // When user changes colours in Firefox, text colour inside <button> is always black
322
+ // (regardless of the custom colours the user has set). This is fine when the text in the
323
+ // button is not nested inside another element because when user changes colours in Firefox,
324
+ // the immediate background colour of buttons is always white (again, regardless of user's
325
+ // custom colours).
326
+ //
327
+ // However, when the text inside <button> is wrapped inside another element AND that element
328
+ // sets a background colour, the text colour is still black but the background of that nested
329
+ // element gets the user's custom background colour. When the custom background is a lighter
330
+ // hue, the contrast might be sufficient. But if the user's custom background colour is a
331
+ // darker colour, the contrast with the text might not be sufficient.
332
+ //
333
+ // To ensure sufficient contrast, override the background colour set by the focus state on the
334
+ // nested elements to be transparent.
335
+ //
336
+ // Also override the background colour of the Show/Hide chevrons which set a background colour
337
+ // on hover.
338
+ @media screen and (forced-colors: active) {
339
+ .govuk-accordion__show-all:hover,
340
+ .govuk-accordion__section-button:hover {
341
+ .govuk-accordion-nav__chevron {
342
+ background-color: transparent;
343
+ }
344
+ }
186
345
 
187
- .govuk-accordion__icon:after {
188
- height: 100%;
346
+ .govuk-accordion__show-all:focus,
347
+ .govuk-accordion__section-button:focus {
348
+ .govuk-accordion__section-heading-text-focus,
349
+ .govuk-accordion__section-summary-focus,
350
+ .govuk-accordion__section-toggle-focus,
351
+ .govuk-accordion-nav__chevron {
352
+ background: transparent;
353
+ background-color: transparent;
354
+ }
355
+ }
189
356
  }
190
357
 
191
- // Vertical bar should be hidden when section is open, to display a '-' icon
192
- .govuk-accordion__section--expanded .govuk-accordion__icon:after {
193
- content: " ";
194
- display: none;
358
+ // For devices that can't hover such as touch devices,
359
+ // remove hover state as it can be stuck in that state (iOS).
360
+ @media (hover: none) {
361
+ .govuk-accordion__section-header:hover {
362
+ border-top-color: $govuk-border-colour;
363
+
364
+ box-shadow: inset 0 3px 0 0 $govuk-link-colour;
365
+
366
+ .govuk-accordion__section-button {
367
+ border-top-color: $govuk-border-colour;
368
+ }
369
+ }
195
370
  }
196
371
  }
197
372
  }