govuk_publishing_components 35.3.3 → 35.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (272) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-core.js +4 -0
  3. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/init-ga4.js +1 -1
  4. data/app/assets/stylesheets/component_guide/application.scss +37 -1
  5. data/app/assets/stylesheets/govuk_publishing_components/components/_metadata.scss +10 -6
  6. data/app/assets/stylesheets/govuk_publishing_components/components/_organisation-logo.scss +2 -2
  7. data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_brand-colours.scss +0 -24
  8. data/app/views/govuk_publishing_components/component_guide/example.html.erb +1 -1
  9. data/app/views/govuk_publishing_components/component_guide/preview.html.erb +1 -1
  10. data/app/views/govuk_publishing_components/component_guide/show.html.erb +1 -1
  11. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +2 -2
  12. data/app/views/govuk_publishing_components/components/_metadata.html.erb +1 -1
  13. data/app/views/govuk_publishing_components/components/_related_navigation.html.erb +3 -1
  14. data/app/views/govuk_publishing_components/components/_share_links.html.erb +6 -2
  15. data/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb +1 -1
  16. data/app/views/govuk_publishing_components/components/docs/metadata.yml +1 -3
  17. data/app/views/govuk_publishing_components/components/docs/organisation_logo.yml +5 -5
  18. data/app/views/govuk_publishing_components/components/docs/step_by_step_nav_related.yml +1 -0
  19. data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +1 -1
  20. data/app/views/layouts/govuk_publishing_components/application.html.erb +1 -0
  21. data/config/locales/en.yml +2 -2
  22. data/lib/govuk_publishing_components/app_helpers/asset_helper.rb +4 -0
  23. data/lib/govuk_publishing_components/presenters/breadcrumbs_helper.rb +1 -1
  24. data/lib/govuk_publishing_components/version.rb +1 -1
  25. data/node_modules/axe-core/axe.d.ts +77 -6
  26. data/node_modules/axe-core/axe.js +955 -600
  27. data/node_modules/axe-core/axe.min.js +2 -2
  28. data/node_modules/axe-core/locales/_template.json +6 -6
  29. data/node_modules/axe-core/locales/ja.json +91 -11
  30. data/node_modules/axe-core/package.json +5 -5
  31. data/node_modules/axe-core/sri-history.json +4 -0
  32. data/node_modules/govuk-frontend/README.md +4 -5
  33. data/node_modules/govuk-frontend/govuk/all-ie8.scss +8 -0
  34. data/node_modules/govuk-frontend/govuk/all.js +738 -258
  35. data/node_modules/govuk-frontend/govuk/all.js.map +1 -1
  36. data/node_modules/govuk-frontend/govuk/common/closest-attribute-value.js +11 -7
  37. data/node_modules/govuk-frontend/govuk/common/closest-attribute-value.js.map +1 -1
  38. data/node_modules/govuk-frontend/govuk/common/govuk-frontend-version.js +17 -0
  39. data/node_modules/govuk-frontend/govuk/common/govuk-frontend-version.js.map +1 -0
  40. data/node_modules/govuk-frontend/govuk/common/index.js +16 -4
  41. data/node_modules/govuk-frontend/govuk/common/index.js.map +1 -1
  42. data/node_modules/govuk-frontend/govuk/common/normalise-dataset.js +20 -10
  43. data/node_modules/govuk-frontend/govuk/common/normalise-dataset.js.map +1 -1
  44. data/node_modules/govuk-frontend/govuk/common.js +16 -4
  45. data/node_modules/govuk-frontend/govuk/common.js.map +1 -1
  46. data/node_modules/govuk-frontend/govuk/components/accordion/_index.scss +3 -3
  47. data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js +234 -86
  48. data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js.map +1 -1
  49. data/node_modules/govuk-frontend/govuk/components/accordion/fixtures.json +32 -13
  50. data/node_modules/govuk-frontend/govuk/components/accordion/macro-options.json +8 -2
  51. data/node_modules/govuk-frontend/govuk/components/accordion/template.njk +1 -0
  52. data/node_modules/govuk-frontend/govuk/components/back-link/_index.scss +1 -1
  53. data/node_modules/govuk-frontend/govuk/components/back-link/fixtures.json +1 -1
  54. data/node_modules/govuk-frontend/govuk/components/back-link/macro-options.json +1 -1
  55. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_index.scss +1 -1
  56. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/fixtures.json +12 -12
  57. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/macro-options.json +1 -1
  58. data/node_modules/govuk-frontend/govuk/components/button/_index.scss +8 -6
  59. data/node_modules/govuk-frontend/govuk/components/button/button.js +54 -19
  60. data/node_modules/govuk-frontend/govuk/components/button/button.js.map +1 -1
  61. data/node_modules/govuk-frontend/govuk/components/button/fixtures.json +11 -1
  62. data/node_modules/govuk-frontend/govuk/components/button/macro-options.json +7 -1
  63. data/node_modules/govuk-frontend/govuk/components/button/template.njk +1 -1
  64. data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +170 -76
  65. data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js.map +1 -1
  66. data/node_modules/govuk-frontend/govuk/components/character-count/fixtures.json +24 -24
  67. data/node_modules/govuk-frontend/govuk/components/character-count/macro-options.json +3 -3
  68. data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +6 -6
  69. data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +75 -24
  70. data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js.map +1 -1
  71. data/node_modules/govuk-frontend/govuk/components/checkboxes/fixtures.json +47 -47
  72. data/node_modules/govuk-frontend/govuk/components/checkboxes/macro-options.json +1 -1
  73. data/node_modules/govuk-frontend/govuk/components/checkboxes/template.njk +3 -3
  74. data/node_modules/govuk-frontend/govuk/components/cookie-banner/fixtures.json +24 -24
  75. data/node_modules/govuk-frontend/govuk/components/cookie-banner/macro-options.json +1 -1
  76. data/node_modules/govuk-frontend/govuk/components/date-input/fixtures.json +26 -26
  77. data/node_modules/govuk-frontend/govuk/components/date-input/macro-options.json +1 -1
  78. data/node_modules/govuk-frontend/govuk/components/date-input/template.njk +1 -1
  79. data/node_modules/govuk-frontend/govuk/components/details/details.js +39 -13
  80. data/node_modules/govuk-frontend/govuk/components/details/details.js.map +1 -1
  81. data/node_modules/govuk-frontend/govuk/components/details/fixtures.json +1 -1
  82. data/node_modules/govuk-frontend/govuk/components/details/macro-options.json +1 -1
  83. data/node_modules/govuk-frontend/govuk/components/error-message/fixtures.json +10 -10
  84. data/node_modules/govuk-frontend/govuk/components/error-message/macro-options.json +1 -1
  85. data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js +67 -27
  86. data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js.map +1 -1
  87. data/node_modules/govuk-frontend/govuk/components/error-summary/fixtures.json +19 -19
  88. data/node_modules/govuk-frontend/govuk/components/error-summary/macro-options.json +1 -1
  89. data/node_modules/govuk-frontend/govuk/components/fieldset/fixtures.json +19 -19
  90. data/node_modules/govuk-frontend/govuk/components/fieldset/macro-options.json +1 -1
  91. data/node_modules/govuk-frontend/govuk/components/file-upload/_index.scss +6 -1
  92. data/node_modules/govuk-frontend/govuk/components/file-upload/fixtures.json +14 -14
  93. data/node_modules/govuk-frontend/govuk/components/file-upload/macro-options.json +7 -1
  94. data/node_modules/govuk-frontend/govuk/components/file-upload/template.njk +2 -1
  95. data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +0 -7
  96. data/node_modules/govuk-frontend/govuk/components/footer/fixtures.json +24 -24
  97. data/node_modules/govuk-frontend/govuk/components/footer/macro-options.json +1 -1
  98. data/node_modules/govuk-frontend/govuk/components/header/fixtures.json +22 -22
  99. data/node_modules/govuk-frontend/govuk/components/header/header.js +46 -14
  100. data/node_modules/govuk-frontend/govuk/components/header/header.js.map +1 -1
  101. data/node_modules/govuk-frontend/govuk/components/header/macro-options.json +1 -1
  102. data/node_modules/govuk-frontend/govuk/components/header/template.njk +1 -1
  103. data/node_modules/govuk-frontend/govuk/components/hint/fixtures.json +1 -1
  104. data/node_modules/govuk-frontend/govuk/components/hint/macro-options.json +1 -1
  105. data/node_modules/govuk-frontend/govuk/components/input/_index.scss +15 -3
  106. data/node_modules/govuk-frontend/govuk/components/input/fixtures.json +54 -41
  107. data/node_modules/govuk-frontend/govuk/components/input/macro-options.json +7 -1
  108. data/node_modules/govuk-frontend/govuk/components/input/template.njk +2 -1
  109. data/node_modules/govuk-frontend/govuk/components/inset-text/fixtures.json +1 -1
  110. data/node_modules/govuk-frontend/govuk/components/inset-text/macro-options.json +1 -1
  111. data/node_modules/govuk-frontend/govuk/components/label/fixtures.json +6 -6
  112. data/node_modules/govuk-frontend/govuk/components/label/macro-options.json +1 -1
  113. data/node_modules/govuk-frontend/govuk/components/notification-banner/fixtures.json +1 -1
  114. data/node_modules/govuk-frontend/govuk/components/notification-banner/macro-options.json +1 -1
  115. data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js +49 -22
  116. data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js.map +1 -1
  117. data/node_modules/govuk-frontend/govuk/components/pagination/fixtures.json +16 -16
  118. data/node_modules/govuk-frontend/govuk/components/pagination/macro-options.json +1 -1
  119. data/node_modules/govuk-frontend/govuk/components/panel/fixtures.json +10 -10
  120. data/node_modules/govuk-frontend/govuk/components/panel/macro-options.json +1 -1
  121. data/node_modules/govuk-frontend/govuk/components/phase-banner/fixtures.json +1 -1
  122. data/node_modules/govuk-frontend/govuk/components/phase-banner/macro-options.json +1 -1
  123. data/node_modules/govuk-frontend/govuk/components/radios/_index.scss +5 -5
  124. data/node_modules/govuk-frontend/govuk/components/radios/fixtures.json +46 -46
  125. data/node_modules/govuk-frontend/govuk/components/radios/macro-options.json +1 -1
  126. data/node_modules/govuk-frontend/govuk/components/radios/radios.js +65 -22
  127. data/node_modules/govuk-frontend/govuk/components/radios/radios.js.map +1 -1
  128. data/node_modules/govuk-frontend/govuk/components/radios/template.njk +2 -2
  129. data/node_modules/govuk-frontend/govuk/components/select/_index.scss +7 -1
  130. data/node_modules/govuk-frontend/govuk/components/select/fixtures.json +19 -20
  131. data/node_modules/govuk-frontend/govuk/components/select/macro-options.json +7 -1
  132. data/node_modules/govuk-frontend/govuk/components/select/template.njk +5 -2
  133. data/node_modules/govuk-frontend/govuk/components/skip-link/fixtures.json +1 -1
  134. data/node_modules/govuk-frontend/govuk/components/skip-link/macro-options.json +1 -1
  135. data/node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js +41 -13
  136. data/node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js.map +1 -1
  137. data/node_modules/govuk-frontend/govuk/components/summary-list/fixtures.json +34 -34
  138. data/node_modules/govuk-frontend/govuk/components/summary-list/macro-options.json +1 -1
  139. data/node_modules/govuk-frontend/govuk/components/table/fixtures.json +21 -21
  140. data/node_modules/govuk-frontend/govuk/components/table/macro-options.json +1 -1
  141. data/node_modules/govuk-frontend/govuk/components/tabs/fixtures.json +15 -15
  142. data/node_modules/govuk-frontend/govuk/components/tabs/macro-options.json +1 -1
  143. data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js +178 -60
  144. data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js.map +1 -1
  145. data/node_modules/govuk-frontend/govuk/components/tabs/template.njk +1 -1
  146. data/node_modules/govuk-frontend/govuk/components/tag/_index.scss +18 -18
  147. data/node_modules/govuk-frontend/govuk/components/tag/fixtures.json +1 -1
  148. data/node_modules/govuk-frontend/govuk/components/tag/macro-options.json +1 -1
  149. data/node_modules/govuk-frontend/govuk/components/textarea/_index.scss +8 -1
  150. data/node_modules/govuk-frontend/govuk/components/textarea/fixtures.json +18 -18
  151. data/node_modules/govuk-frontend/govuk/components/textarea/macro-options.json +7 -1
  152. data/node_modules/govuk-frontend/govuk/components/textarea/template.njk +2 -1
  153. data/node_modules/govuk-frontend/govuk/components/warning-text/fixtures.json +9 -5
  154. data/node_modules/govuk-frontend/govuk/components/warning-text/macro-options.json +3 -3
  155. data/node_modules/govuk-frontend/govuk/components/warning-text/template.njk +1 -1
  156. data/node_modules/govuk-frontend/govuk/core/_all.scss +1 -0
  157. data/node_modules/govuk-frontend/govuk/core/_govuk-frontend-version.scss +5 -0
  158. data/node_modules/govuk-frontend/govuk/helpers/_colour.scss +5 -2
  159. data/node_modules/govuk-frontend/govuk/helpers/_focused.scss +1 -1
  160. data/node_modules/govuk-frontend/govuk/helpers/_font-faces.scss +1 -1
  161. data/node_modules/govuk-frontend/govuk/i18n.js +38 -30
  162. data/node_modules/govuk-frontend/govuk/i18n.js.map +1 -1
  163. data/node_modules/govuk-frontend/govuk/macros/i18n.njk +12 -11
  164. data/node_modules/govuk-frontend/govuk/objects/_width-container.scss +1 -1
  165. data/node_modules/govuk-frontend/govuk/settings/_colours-organisations.scss +4 -0
  166. data/node_modules/govuk-frontend/govuk/settings/_ie8.scss +16 -0
  167. data/node_modules/govuk-frontend/govuk/settings/_links.scss +5 -1
  168. data/node_modules/govuk-frontend/govuk/tools/_ie8.scss +38 -2
  169. data/node_modules/govuk-frontend/govuk/vendor/polyfills/DOMTokenList.js +2 -1
  170. data/node_modules/govuk-frontend/govuk/vendor/polyfills/DOMTokenList.js.map +1 -1
  171. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Date/now.js +2 -1
  172. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Date/now.js.map +1 -1
  173. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Document.js +2 -1
  174. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Document.js.map +1 -1
  175. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/classList.js +10 -3
  176. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/classList.js.map +1 -1
  177. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/closest.js +4 -1
  178. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/closest.js.map +1 -1
  179. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/dataset.js +13 -7
  180. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/dataset.js.map +1 -1
  181. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/matches.js +2 -1
  182. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/matches.js.map +1 -1
  183. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js +8 -2
  184. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js.map +1 -1
  185. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js +8 -2
  186. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js.map +1 -1
  187. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element.js +4 -1
  188. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element.js.map +1 -1
  189. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Event.js +10 -3
  190. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Event.js.map +1 -1
  191. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Function/prototype/bind.js +4 -1
  192. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Function/prototype/bind.js.map +1 -1
  193. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Object/defineProperty.js +2 -1
  194. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Object/defineProperty.js.map +1 -1
  195. data/node_modules/govuk-frontend/govuk/vendor/polyfills/String/prototype/trim.js +3 -2
  196. data/node_modules/govuk-frontend/govuk/vendor/polyfills/String/prototype/trim.js.map +1 -1
  197. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Window.js +2 -1
  198. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Window.js.map +1 -1
  199. data/node_modules/govuk-frontend/govuk-esm/all.mjs +81 -60
  200. data/node_modules/govuk-frontend/govuk-esm/all.mjs.map +1 -0
  201. data/node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs +12 -8
  202. data/node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs.map +1 -0
  203. data/node_modules/govuk-frontend/govuk-esm/common/govuk-frontend-version.mjs +9 -0
  204. data/node_modules/govuk-frontend/govuk-esm/common/govuk-frontend-version.mjs.map +1 -0
  205. data/node_modules/govuk-frontend/govuk-esm/common/index.mjs +44 -29
  206. data/node_modules/govuk-frontend/govuk-esm/common/index.mjs.map +1 -0
  207. data/node_modules/govuk-frontend/govuk-esm/common/normalise-dataset.mjs +15 -9
  208. data/node_modules/govuk-frontend/govuk-esm/common/normalise-dataset.mjs.map +1 -0
  209. data/node_modules/govuk-frontend/govuk-esm/common.mjs +3 -5
  210. data/node_modules/govuk-frontend/govuk-esm/common.mjs.map +1 -0
  211. data/node_modules/govuk-frontend/govuk-esm/components/accordion/accordion.mjs +319 -211
  212. data/node_modules/govuk-frontend/govuk-esm/components/accordion/accordion.mjs.map +1 -0
  213. data/node_modules/govuk-frontend/govuk-esm/components/button/button.mjs +47 -30
  214. data/node_modules/govuk-frontend/govuk-esm/components/button/button.mjs.map +1 -0
  215. data/node_modules/govuk-frontend/govuk-esm/components/character-count/character-count.mjs +169 -115
  216. data/node_modules/govuk-frontend/govuk-esm/components/character-count/character-count.mjs.map +1 -0
  217. data/node_modules/govuk-frontend/govuk-esm/components/checkboxes/checkboxes.mjs +88 -51
  218. data/node_modules/govuk-frontend/govuk-esm/components/checkboxes/checkboxes.mjs.map +1 -0
  219. data/node_modules/govuk-frontend/govuk-esm/components/details/details.mjs +64 -54
  220. data/node_modules/govuk-frontend/govuk-esm/components/details/details.mjs.map +1 -0
  221. data/node_modules/govuk-frontend/govuk-esm/components/error-summary/error-summary.mjs +69 -50
  222. data/node_modules/govuk-frontend/govuk-esm/components/error-summary/error-summary.mjs.map +1 -0
  223. data/node_modules/govuk-frontend/govuk-esm/components/header/header.mjs +59 -35
  224. data/node_modules/govuk-frontend/govuk-esm/components/header/header.mjs.map +1 -0
  225. data/node_modules/govuk-frontend/govuk-esm/components/notification-banner/notification-banner.mjs +36 -25
  226. data/node_modules/govuk-frontend/govuk-esm/components/notification-banner/notification-banner.mjs.map +1 -0
  227. data/node_modules/govuk-frontend/govuk-esm/components/radios/radios.mjs +67 -38
  228. data/node_modules/govuk-frontend/govuk-esm/components/radios/radios.mjs.map +1 -0
  229. data/node_modules/govuk-frontend/govuk-esm/components/skip-link/skip-link.mjs +49 -32
  230. data/node_modules/govuk-frontend/govuk-esm/components/skip-link/skip-link.mjs.map +1 -0
  231. data/node_modules/govuk-frontend/govuk-esm/components/tabs/tabs.mjs +263 -163
  232. data/node_modules/govuk-frontend/govuk-esm/components/tabs/tabs.mjs.map +1 -0
  233. data/node_modules/govuk-frontend/govuk-esm/i18n.mjs +68 -57
  234. data/node_modules/govuk-frontend/govuk-esm/i18n.mjs.map +1 -0
  235. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/DOMTokenList.mjs +5 -3
  236. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/DOMTokenList.mjs.map +1 -0
  237. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Date/now.mjs +4 -2
  238. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Date/now.mjs.map +1 -0
  239. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Document.mjs +4 -2
  240. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Document.mjs.map +1 -0
  241. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/classList.mjs +7 -4
  242. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/classList.mjs.map +1 -0
  243. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs +5 -2
  244. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs.map +1 -0
  245. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/dataset.mjs +13 -10
  246. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/dataset.mjs.map +1 -0
  247. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/matches.mjs +4 -2
  248. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/matches.mjs.map +1 -0
  249. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/nextElementSibling.mjs +6 -3
  250. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/nextElementSibling.mjs.map +1 -0
  251. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/previousElementSibling.mjs +6 -3
  252. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/previousElementSibling.mjs.map +1 -0
  253. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element.mjs +5 -2
  254. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element.mjs.map +1 -0
  255. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Event.mjs +7 -4
  256. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Event.mjs.map +1 -0
  257. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Function/prototype/bind.mjs +5 -2
  258. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Function/prototype/bind.mjs.map +1 -0
  259. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Object/defineProperty.mjs +4 -2
  260. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Object/defineProperty.mjs.map +1 -0
  261. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/String/prototype/trim.mjs +5 -3
  262. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/String/prototype/trim.mjs.map +1 -0
  263. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Window.mjs +4 -2
  264. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Window.mjs.map +1 -0
  265. data/node_modules/govuk-frontend/govuk-prototype-kit/init.js +1 -0
  266. data/node_modules/govuk-frontend/govuk-prototype-kit.config.json +2 -1
  267. data/node_modules/govuk-frontend/package.json +3 -2
  268. metadata +44 -7
  269. /data/app/assets/images/govuk_publishing_components/crests/{dit_crest_13px.png → dbt_crest_13px.png} +0 -0
  270. /data/app/assets/images/govuk_publishing_components/crests/{dit_crest_13px_x2.png → dbt_crest_13px_x2.png} +0 -0
  271. /data/app/assets/images/govuk_publishing_components/crests/{dit_crest_18px.png → dbt_crest_18px.png} +0 -0
  272. /data/app/assets/images/govuk_publishing_components/crests/{dit_crest_18px_x2.png → dbt_crest_18px_x2.png} +0 -0
@@ -19,8 +19,10 @@
19
19
  * This seems to fail in IE8, requires more investigation.
20
20
  * See: https://github.com/imagitama/nodelist-foreach-polyfill
21
21
  *
22
- * @param {NodeListOf<Element>} nodes - NodeList from querySelectorAll()
23
- * @param {nodeListIterator} callback - Callback function to run for each node
22
+ * @deprecated Will be made private in v5.0
23
+ * @template {Node} ElementType
24
+ * @param {NodeListOf<ElementType>} nodes - NodeList from querySelectorAll()
25
+ * @param {nodeListIterator<ElementType>} callback - Callback function to run for each node
24
26
  * @returns {void}
25
27
  */
26
28
  function nodeListForEach (nodes, callback) {
@@ -33,14 +35,16 @@
33
35
  }
34
36
 
35
37
  /**
38
+ * @template {Node} ElementType
36
39
  * @callback nodeListIterator
37
- * @param {Element} value - The current node being iterated on
40
+ * @param {ElementType} value - The current node being iterated on
38
41
  * @param {number} index - The current index in the iteration
39
- * @param {NodeListOf<Element>} nodes - NodeList from querySelectorAll()
42
+ * @param {NodeListOf<ElementType>} nodes - NodeList from querySelectorAll()
40
43
  * @returns {void}
41
44
  */
42
45
 
43
- (function(undefined) {
46
+ // @ts-nocheck
47
+ (function (undefined) {
44
48
 
45
49
  // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Object/defineProperty/detect.js
46
50
  var detect = (
@@ -127,7 +131,8 @@
127
131
  })
128
132
  .call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
129
133
 
130
- (function(undefined) {
134
+ // @ts-nocheck
135
+ (function (undefined) {
131
136
 
132
137
  // Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/master/packages/polyfill-library/polyfills/DOMTokenList/detect.js
133
138
  var detect = (
@@ -392,7 +397,8 @@
392
397
 
393
398
  }).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
394
399
 
395
- (function(undefined) {
400
+ // @ts-nocheck
401
+ (function (undefined) {
396
402
 
397
403
  // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Document/detect.js
398
404
  var detect = ("Document" in this);
@@ -419,6 +425,8 @@
419
425
  })
420
426
  .call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
421
427
 
428
+ // @ts-nocheck
429
+
422
430
  (function(undefined) {
423
431
 
424
432
  // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Element/detect.js
@@ -532,6 +540,8 @@
532
540
  })
533
541
  .call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
534
542
 
543
+ // @ts-nocheck
544
+
535
545
  (function(undefined) {
536
546
 
537
547
  // Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/8717a9e04ac7aff99b4980fbedead98036b0929a/packages/polyfill-library/polyfills/Element/prototype/classList/detect.js
@@ -622,6 +632,8 @@
622
632
 
623
633
  }).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
624
634
 
635
+ // @ts-nocheck
636
+
625
637
  (function(undefined) {
626
638
 
627
639
  // Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-library/master/polyfills/Element/prototype/nextElementSibling/detect.js
@@ -642,6 +654,8 @@
642
654
 
643
655
  }).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
644
656
 
657
+ // @ts-nocheck
658
+
645
659
  (function(undefined) {
646
660
 
647
661
  // Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-library/master/polyfills/Element/prototype/previousElementSibling/detect.js
@@ -662,7 +676,8 @@
662
676
 
663
677
  }).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
664
678
 
665
- (function(undefined) {
679
+ // @ts-nocheck
680
+ (function (undefined) {
666
681
 
667
682
  // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Window/detect.js
668
683
  var detect = ('Window' in this);
@@ -683,6 +698,8 @@
683
698
  })
684
699
  .call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
685
700
 
701
+ // @ts-nocheck
702
+
686
703
  (function(undefined) {
687
704
 
688
705
  // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Event/detect.js
@@ -932,6 +949,8 @@
932
949
  })
933
950
  .call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
934
951
 
952
+ // @ts-nocheck
953
+
935
954
  (function(undefined) {
936
955
  // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Function/prototype/bind/detect.js
937
956
  var detect = 'bind' in Function.prototype;
@@ -1096,20 +1115,54 @@
1096
1115
  * Tabs component
1097
1116
  *
1098
1117
  * @class
1099
- * @param {HTMLElement} $module - HTML element to use for tabs
1118
+ * @param {Element} $module - HTML element to use for tabs
1100
1119
  */
1101
1120
  function Tabs ($module) {
1121
+ if (!($module instanceof HTMLElement)) {
1122
+ return this
1123
+ }
1124
+
1125
+ var $tabs = $module.querySelectorAll('a.govuk-tabs__tab');
1126
+ if (!$tabs.length) {
1127
+ return this
1128
+ }
1129
+
1130
+ /** @deprecated Will be made private in v5.0 */
1102
1131
  this.$module = $module;
1103
- this.$tabs = $module.querySelectorAll('.govuk-tabs__tab');
1104
1132
 
1133
+ /** @deprecated Will be made private in v5.0 */
1134
+ this.$tabs = $tabs;
1135
+
1136
+ /** @deprecated Will be made private in v5.0 */
1105
1137
  this.keys = { left: 37, right: 39, up: 38, down: 40 };
1138
+
1139
+ /** @deprecated Will be made private in v5.0 */
1106
1140
  this.jsHiddenClass = 'govuk-tabs__panel--hidden';
1141
+
1142
+ // Save bounded functions to use when removing event listeners during teardown
1143
+
1144
+ /** @deprecated Will be made private in v5.0 */
1145
+ this.boundTabClick = this.onTabClick.bind(this);
1146
+
1147
+ /** @deprecated Will be made private in v5.0 */
1148
+ this.boundTabKeydown = this.onTabKeydown.bind(this);
1149
+
1150
+ /** @deprecated Will be made private in v5.0 */
1151
+ this.boundOnHashChange = this.onHashChange.bind(this);
1152
+
1153
+ /** @deprecated Will be made private in v5.0 */
1154
+ this.changingHash = false;
1107
1155
  }
1108
1156
 
1109
1157
  /**
1110
1158
  * Initialise component
1111
1159
  */
1112
1160
  Tabs.prototype.init = function () {
1161
+ // Check that required elements are present
1162
+ if (!this.$module || !this.$tabs) {
1163
+ return
1164
+ }
1165
+
1113
1166
  if (typeof window.matchMedia === 'function') {
1114
1167
  this.setupResponsiveChecks();
1115
1168
  } else {
@@ -1119,8 +1172,11 @@
1119
1172
 
1120
1173
  /**
1121
1174
  * Setup viewport resize check
1175
+ *
1176
+ * @deprecated Will be made private in v5.0
1122
1177
  */
1123
1178
  Tabs.prototype.setupResponsiveChecks = function () {
1179
+ /** @deprecated Will be made private in v5.0 */
1124
1180
  this.mql = window.matchMedia('(min-width: 40.0625em)');
1125
1181
  this.mql.addListener(this.checkMode.bind(this));
1126
1182
  this.checkMode();
@@ -1128,6 +1184,8 @@
1128
1184
 
1129
1185
  /**
1130
1186
  * Setup or teardown handler for viewport resize check
1187
+ *
1188
+ * @deprecated Will be made private in v5.0
1131
1189
  */
1132
1190
  Tabs.prototype.checkMode = function () {
1133
1191
  if (this.mql.matches) {
@@ -1139,8 +1197,11 @@
1139
1197
 
1140
1198
  /**
1141
1199
  * Setup tab component
1200
+ *
1201
+ * @deprecated Will be made private in v5.0
1142
1202
  */
1143
1203
  Tabs.prototype.setup = function () {
1204
+ var $component = this;
1144
1205
  var $module = this.$module;
1145
1206
  var $tabs = this.$tabs;
1146
1207
  var $tabList = $module.querySelector('.govuk-tabs__list');
@@ -1158,37 +1219,39 @@
1158
1219
 
1159
1220
  nodeListForEach($tabs, function ($tab) {
1160
1221
  // Set HTML attributes
1161
- this.setAttributes($tab);
1162
-
1163
- // Save bounded functions to use when removing event listeners during teardown
1164
- $tab.boundTabClick = this.onTabClick.bind(this);
1165
- $tab.boundTabKeydown = this.onTabKeydown.bind(this);
1222
+ $component.setAttributes($tab);
1166
1223
 
1167
1224
  // Handle events
1168
- $tab.addEventListener('click', $tab.boundTabClick, true);
1169
- $tab.addEventListener('keydown', $tab.boundTabKeydown, true);
1225
+ $tab.addEventListener('click', $component.boundTabClick, true);
1226
+ $tab.addEventListener('keydown', $component.boundTabKeydown, true);
1170
1227
 
1171
1228
  // Remove old active panels
1172
- this.hideTab($tab);
1173
- }.bind(this));
1229
+ $component.hideTab($tab);
1230
+ });
1174
1231
 
1175
1232
  // Show either the active tab according to the URL's hash or the first tab
1176
1233
  var $activeTab = this.getTab(window.location.hash) || this.$tabs[0];
1234
+ if (!$activeTab) {
1235
+ return
1236
+ }
1237
+
1177
1238
  this.showTab($activeTab);
1178
1239
 
1179
1240
  // Handle hashchange events
1180
- $module.boundOnHashChange = this.onHashChange.bind(this);
1181
- window.addEventListener('hashchange', $module.boundOnHashChange, true);
1241
+ window.addEventListener('hashchange', this.boundOnHashChange, true);
1182
1242
  };
1183
1243
 
1184
1244
  /**
1185
1245
  * Teardown tab component
1246
+ *
1247
+ * @deprecated Will be made private in v5.0
1186
1248
  */
1187
1249
  Tabs.prototype.teardown = function () {
1250
+ var $component = this;
1188
1251
  var $module = this.$module;
1189
1252
  var $tabs = this.$tabs;
1190
1253
  var $tabList = $module.querySelector('.govuk-tabs__list');
1191
- var $tabListItems = $module.querySelectorAll('.govuk-tabs__list-item');
1254
+ var $tabListItems = $module.querySelectorAll('a.govuk-tabs__list-item');
1192
1255
 
1193
1256
  if (!$tabs || !$tabList || !$tabListItems) {
1194
1257
  return
@@ -1197,29 +1260,29 @@
1197
1260
  $tabList.removeAttribute('role');
1198
1261
 
1199
1262
  nodeListForEach($tabListItems, function ($item) {
1200
- $item.removeAttribute('role', 'presentation');
1263
+ $item.removeAttribute('role');
1201
1264
  });
1202
1265
 
1203
1266
  nodeListForEach($tabs, function ($tab) {
1204
1267
  // Remove events
1205
- $tab.removeEventListener('click', $tab.boundTabClick, true);
1206
- $tab.removeEventListener('keydown', $tab.boundTabKeydown, true);
1268
+ $tab.removeEventListener('click', $component.boundTabClick, true);
1269
+ $tab.removeEventListener('keydown', $component.boundTabKeydown, true);
1207
1270
 
1208
1271
  // Unset HTML attributes
1209
- this.unsetAttributes($tab);
1210
- }.bind(this));
1272
+ $component.unsetAttributes($tab);
1273
+ });
1211
1274
 
1212
1275
  // Remove hashchange event handler
1213
- window.removeEventListener('hashchange', $module.boundOnHashChange, true);
1276
+ window.removeEventListener('hashchange', this.boundOnHashChange, true);
1214
1277
  };
1215
1278
 
1216
1279
  /**
1217
1280
  * Handle hashchange event
1218
1281
  *
1219
- * @param {HashChangeEvent} event - Hash change event
1282
+ * @deprecated Will be made private in v5.0
1220
1283
  * @returns {void | undefined} Returns void, or undefined when prevented
1221
1284
  */
1222
- Tabs.prototype.onHashChange = function (event) {
1285
+ Tabs.prototype.onHashChange = function () {
1223
1286
  var hash = window.location.hash;
1224
1287
  var $tabWithHash = this.getTab(hash);
1225
1288
  if (!$tabWithHash) {
@@ -1234,6 +1297,9 @@
1234
1297
 
1235
1298
  // Show either the active tab according to the URL's hash or the first tab
1236
1299
  var $previousTab = this.getCurrentTab();
1300
+ if (!$previousTab) {
1301
+ return
1302
+ }
1237
1303
 
1238
1304
  this.hideTab($previousTab);
1239
1305
  this.showTab($tabWithHash);
@@ -1243,6 +1309,7 @@
1243
1309
  /**
1244
1310
  * Hide panel for tab link
1245
1311
  *
1312
+ * @deprecated Will be made private in v5.0
1246
1313
  * @param {HTMLAnchorElement} $tab - Tab link
1247
1314
  */
1248
1315
  Tabs.prototype.hideTab = function ($tab) {
@@ -1253,6 +1320,7 @@
1253
1320
  /**
1254
1321
  * Show panel for tab link
1255
1322
  *
1323
+ * @deprecated Will be made private in v5.0
1256
1324
  * @param {HTMLAnchorElement} $tab - Tab link
1257
1325
  */
1258
1326
  Tabs.prototype.showTab = function ($tab) {
@@ -1263,16 +1331,19 @@
1263
1331
  /**
1264
1332
  * Get tab link by hash
1265
1333
  *
1334
+ * @deprecated Will be made private in v5.0
1266
1335
  * @param {string} hash - Hash fragment including #
1267
1336
  * @returns {HTMLAnchorElement | null} Tab link
1268
1337
  */
1269
1338
  Tabs.prototype.getTab = function (hash) {
1270
- return this.$module.querySelector('.govuk-tabs__tab[href="' + hash + '"]')
1339
+ // @ts-expect-error `HTMLAnchorElement` type expected
1340
+ return this.$module.querySelector('a.govuk-tabs__tab[href="' + hash + '"]')
1271
1341
  };
1272
1342
 
1273
1343
  /**
1274
1344
  * Set tab link and panel attributes
1275
1345
  *
1346
+ * @deprecated Will be made private in v5.0
1276
1347
  * @param {HTMLAnchorElement} $tab - Tab link
1277
1348
  */
1278
1349
  Tabs.prototype.setAttributes = function ($tab) {
@@ -1286,6 +1357,10 @@
1286
1357
 
1287
1358
  // set panel attributes
1288
1359
  var $panel = this.getPanel($tab);
1360
+ if (!$panel) {
1361
+ return
1362
+ }
1363
+
1289
1364
  $panel.setAttribute('role', 'tabpanel');
1290
1365
  $panel.setAttribute('aria-labelledby', $tab.id);
1291
1366
  $panel.classList.add(this.jsHiddenClass);
@@ -1294,6 +1369,7 @@
1294
1369
  /**
1295
1370
  * Unset tab link and panel attributes
1296
1371
  *
1372
+ * @deprecated Will be made private in v5.0
1297
1373
  * @param {HTMLAnchorElement} $tab - Tab link
1298
1374
  */
1299
1375
  Tabs.prototype.unsetAttributes = function ($tab) {
@@ -1306,6 +1382,10 @@
1306
1382
 
1307
1383
  // unset panel attributes
1308
1384
  var $panel = this.getPanel($tab);
1385
+ if (!$panel) {
1386
+ return
1387
+ }
1388
+
1309
1389
  $panel.removeAttribute('role');
1310
1390
  $panel.removeAttribute('aria-labelledby');
1311
1391
  $panel.classList.remove(this.jsHiddenClass);
@@ -1314,20 +1394,23 @@
1314
1394
  /**
1315
1395
  * Handle tab link clicks
1316
1396
  *
1397
+ * @deprecated Will be made private in v5.0
1317
1398
  * @param {MouseEvent} event - Mouse click event
1318
- * @returns {void | false} Returns void, or false within tab link
1399
+ * @returns {void} Returns void
1319
1400
  */
1320
1401
  Tabs.prototype.onTabClick = function (event) {
1321
- if (!event.target.classList.contains('govuk-tabs__tab')) {
1322
- // Allow events on child DOM elements to bubble up to tab parent
1323
- return false
1402
+ var $currentTab = this.getCurrentTab();
1403
+ var $nextTab = event.currentTarget;
1404
+
1405
+ if (!$currentTab || !($nextTab instanceof HTMLAnchorElement)) {
1406
+ return
1324
1407
  }
1408
+
1325
1409
  event.preventDefault();
1326
- var $newTab = event.target;
1327
- var $currentTab = this.getCurrentTab();
1410
+
1328
1411
  this.hideTab($currentTab);
1329
- this.showTab($newTab);
1330
- this.createHistoryEntry($newTab);
1412
+ this.showTab($nextTab);
1413
+ this.createHistoryEntry($nextTab);
1331
1414
  };
1332
1415
 
1333
1416
  /**
@@ -1336,10 +1419,14 @@
1336
1419
  * - Allows back/forward to navigate tabs
1337
1420
  * - Avoids page jump when hash changes
1338
1421
  *
1422
+ * @deprecated Will be made private in v5.0
1339
1423
  * @param {HTMLAnchorElement} $tab - Tab link
1340
1424
  */
1341
1425
  Tabs.prototype.createHistoryEntry = function ($tab) {
1342
1426
  var $panel = this.getPanel($tab);
1427
+ if (!$panel) {
1428
+ return
1429
+ }
1343
1430
 
1344
1431
  // Save and restore the id
1345
1432
  // so the page doesn't jump when a user clicks a tab (which changes the hash)
@@ -1356,6 +1443,7 @@
1356
1443
  * - Press right/down arrow for next tab
1357
1444
  * - Press left/up arrow for previous tab
1358
1445
  *
1446
+ * @deprecated Will be made private in v5.0
1359
1447
  * @param {KeyboardEvent} event - Keydown event
1360
1448
  */
1361
1449
  Tabs.prototype.onTabKeydown = function (event) {
@@ -1375,10 +1463,12 @@
1375
1463
 
1376
1464
  /**
1377
1465
  * Activate next tab
1466
+ *
1467
+ * @deprecated Will be made private in v5.0
1378
1468
  */
1379
1469
  Tabs.prototype.activateNextTab = function () {
1380
1470
  var $currentTab = this.getCurrentTab();
1381
- if (!$currentTab) {
1471
+ if (!$currentTab || !$currentTab.parentElement) {
1382
1472
  return
1383
1473
  }
1384
1474
 
@@ -1387,21 +1477,25 @@
1387
1477
  return
1388
1478
  }
1389
1479
 
1390
- var $nextTab = $nextTabListItem.querySelector('.govuk-tabs__tab');
1391
- if ($nextTab) {
1392
- this.hideTab($currentTab);
1393
- this.showTab($nextTab);
1394
- $nextTab.focus();
1395
- this.createHistoryEntry($nextTab);
1480
+ var $nextTab = $nextTabListItem.querySelector('a.govuk-tabs__tab');
1481
+ if (!$nextTab) {
1482
+ return
1396
1483
  }
1484
+
1485
+ this.hideTab($currentTab);
1486
+ this.showTab($nextTab);
1487
+ $nextTab.focus();
1488
+ this.createHistoryEntry($nextTab);
1397
1489
  };
1398
1490
 
1399
1491
  /**
1400
1492
  * Activate previous tab
1493
+ *
1494
+ * @deprecated Will be made private in v5.0
1401
1495
  */
1402
1496
  Tabs.prototype.activatePreviousTab = function () {
1403
1497
  var $currentTab = this.getCurrentTab();
1404
- if (!$currentTab) {
1498
+ if (!$currentTab || !$currentTab.parentElement) {
1405
1499
  return
1406
1500
  }
1407
1501
 
@@ -1410,75 +1504,98 @@
1410
1504
  return
1411
1505
  }
1412
1506
 
1413
- var $previousTab = $previousTabListItem.querySelector('.govuk-tabs__tab');
1414
- if ($previousTab) {
1415
- this.hideTab($currentTab);
1416
- this.showTab($previousTab);
1417
- $previousTab.focus();
1418
- this.createHistoryEntry($previousTab);
1507
+ var $previousTab = $previousTabListItem.querySelector('a.govuk-tabs__tab');
1508
+ if (!$previousTab) {
1509
+ return
1419
1510
  }
1511
+
1512
+ this.hideTab($currentTab);
1513
+ this.showTab($previousTab);
1514
+ $previousTab.focus();
1515
+ this.createHistoryEntry($previousTab);
1420
1516
  };
1421
1517
 
1422
1518
  /**
1423
1519
  * Get tab panel for tab link
1424
1520
  *
1521
+ * @deprecated Will be made private in v5.0
1425
1522
  * @param {HTMLAnchorElement} $tab - Tab link
1426
- * @returns {HTMLDivElement} Tab panel
1523
+ * @returns {Element | null} Tab panel
1427
1524
  */
1428
1525
  Tabs.prototype.getPanel = function ($tab) {
1429
- var $panel = this.$module.querySelector(this.getHref($tab));
1430
- return $panel
1526
+ return this.$module.querySelector(this.getHref($tab))
1431
1527
  };
1432
1528
 
1433
1529
  /**
1434
1530
  * Show tab panel for tab link
1435
1531
  *
1532
+ * @deprecated Will be made private in v5.0
1436
1533
  * @param {HTMLAnchorElement} $tab - Tab link
1437
1534
  */
1438
1535
  Tabs.prototype.showPanel = function ($tab) {
1439
1536
  var $panel = this.getPanel($tab);
1537
+ if (!$panel) {
1538
+ return
1539
+ }
1540
+
1440
1541
  $panel.classList.remove(this.jsHiddenClass);
1441
1542
  };
1442
1543
 
1443
1544
  /**
1444
1545
  * Hide tab panel for tab link
1445
1546
  *
1547
+ * @deprecated Will be made private in v5.0
1446
1548
  * @param {HTMLAnchorElement} $tab - Tab link
1447
1549
  */
1448
1550
  Tabs.prototype.hidePanel = function ($tab) {
1449
1551
  var $panel = this.getPanel($tab);
1552
+ if (!$panel) {
1553
+ return
1554
+ }
1555
+
1450
1556
  $panel.classList.add(this.jsHiddenClass);
1451
1557
  };
1452
1558
 
1453
1559
  /**
1454
1560
  * Unset 'selected' state for tab link
1455
1561
  *
1562
+ * @deprecated Will be made private in v5.0
1456
1563
  * @param {HTMLAnchorElement} $tab - Tab link
1457
1564
  */
1458
1565
  Tabs.prototype.unhighlightTab = function ($tab) {
1566
+ if (!$tab.parentElement) {
1567
+ return
1568
+ }
1569
+
1459
1570
  $tab.setAttribute('aria-selected', 'false');
1460
- $tab.parentNode.classList.remove('govuk-tabs__list-item--selected');
1571
+ $tab.parentElement.classList.remove('govuk-tabs__list-item--selected');
1461
1572
  $tab.setAttribute('tabindex', '-1');
1462
1573
  };
1463
1574
 
1464
1575
  /**
1465
1576
  * Set 'selected' state for tab link
1466
1577
  *
1578
+ * @deprecated Will be made private in v5.0
1467
1579
  * @param {HTMLAnchorElement} $tab - Tab link
1468
1580
  */
1469
1581
  Tabs.prototype.highlightTab = function ($tab) {
1582
+ if (!$tab.parentElement) {
1583
+ return
1584
+ }
1585
+
1470
1586
  $tab.setAttribute('aria-selected', 'true');
1471
- $tab.parentNode.classList.add('govuk-tabs__list-item--selected');
1587
+ $tab.parentElement.classList.add('govuk-tabs__list-item--selected');
1472
1588
  $tab.setAttribute('tabindex', '0');
1473
1589
  };
1474
1590
 
1475
1591
  /**
1476
1592
  * Get current tab link
1477
1593
  *
1478
- * @returns {HTMLAnchorElement | undefined} Tab link
1594
+ * @deprecated Will be made private in v5.0
1595
+ * @returns {HTMLAnchorElement | null} Tab link
1479
1596
  */
1480
1597
  Tabs.prototype.getCurrentTab = function () {
1481
- return this.$module.querySelector('.govuk-tabs__list-item--selected .govuk-tabs__tab')
1598
+ return this.$module.querySelector('.govuk-tabs__list-item--selected a.govuk-tabs__tab')
1482
1599
  };
1483
1600
 
1484
1601
  /**
@@ -1488,6 +1605,7 @@
1488
1605
  * should be a utility function most prob
1489
1606
  * {@link http://labs.thesedays.com/blog/2010/01/08/getting-the-href-value-with-jquery-in-ie/}
1490
1607
  *
1608
+ * @deprecated Will be made private in v5.0
1491
1609
  * @param {HTMLAnchorElement} $tab - Tab link
1492
1610
  * @returns {string} Hash fragment including #
1493
1611
  */