hmrc-frontend 6.49.0 → 6.51.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.
package/hmrc/VERSION.txt CHANGED
@@ -1 +1 @@
1
- 6.49.0
1
+ 6.51.0
@@ -1,2 +1,2 @@
1
1
  .autocomplete__wrapper{position:relative}.autocomplete__hint,.autocomplete__input{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:2px solid #0b0c0c;border-radius:0;-webkit-box-sizing:border-box;box-sizing:border-box;height:2.5rem;line-height:1.25;margin-bottom:0;width:100%}.autocomplete__input{background-color:rgba(0,0,0,0);position:relative}.autocomplete__hint{color:#505a5f;position:absolute}.autocomplete__input--default{padding:5px}.autocomplete__input--focused{-webkit-box-shadow:inset 0 0 0 2px;box-shadow:inset 0 0 0 2px;outline:3px solid #fd0;outline-offset:0}.autocomplete__input--show-all-values{cursor:pointer;padding:5px 35px 5px 5px}.autocomplete__dropdown-arrow-down{display:inline-block;height:24px;position:absolute;right:8px;top:10px;width:24px;z-index:-1}.autocomplete__menu{background-color:#fff;border:2px solid #0b0c0c;border-top:0;color:#0b0c0c;margin:0;max-height:342px;overflow-x:hidden;padding:0;width:100%;width:calc(100% - 4px)}.autocomplete__menu--visible{display:block}.autocomplete__menu--hidden{display:none}.autocomplete__menu--overlay{-webkit-box-shadow:0 2px 6px rgba(0,0,0,.257);box-shadow:0 2px 6px rgba(0,0,0,.257);left:0;position:absolute;top:100%;z-index:100}.autocomplete__menu--inline{position:relative}.autocomplete__option{border-bottom:1px solid #b1b4b6;border-left-width:0;border-right-width:0;border-top-width:1px;cursor:pointer;display:block;position:relative}.autocomplete__option>*{pointer-events:none}.autocomplete__option:first-of-type{border-top-width:0}.autocomplete__option:last-of-type{border-bottom-width:0}.autocomplete__option--odd{background-color:#f3f2f1}.autocomplete__option--focused,.autocomplete__option:hover{background-color:#1d70b8;border-color:#1d70b8;color:#fff;outline:none}@media (-ms-high-contrast:active),(forced-colors:active){.autocomplete__menu{border-color:FieldText}.autocomplete__option{background-color:Field;color:FieldText}.autocomplete__option--focused,.autocomplete__option:hover{background-color:Highlight;background-color:SelectedItem;border-color:SelectedItem;color:HighlightText;color:SelectedItemText;forced-color-adjust:none;outline-color:SelectedItemText}}.autocomplete__option--no-results{background-color:#f3f2f1;color:#505a5f;cursor:not-allowed}.autocomplete__hint,.autocomplete__input,.autocomplete__option{font-size:1rem;font-weight:400}.autocomplete__hint,.autocomplete__option{padding:5px}@media (min-width:641px){.autocomplete__hint,.autocomplete__input,.autocomplete__option{font-size:1.1875rem;line-height:1.3157894737}}.autocomplete__hint,.autocomplete__input,.autocomplete__option,.autocomplete__wrapper{font-family:GDS Transport,arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-weight:400;font-size:1rem;line-height:1.25}@media print{.autocomplete__hint,.autocomplete__input,.autocomplete__option,.autocomplete__wrapper{font-family:sans-serif}}@media (min-width:40.0625em){.autocomplete__hint,.autocomplete__input,.autocomplete__option,.autocomplete__wrapper{font-size:1.1875rem;line-height:1.3157894737}}@media print{.autocomplete__hint,.autocomplete__input,.autocomplete__option,.autocomplete__wrapper{font-size:14pt;line-height:1.15}}.govuk-form-group--error div:has(+.govuk-select--error[data-module=hmrc-accessible-autocomplete])>.autocomplete__wrapper .autocomplete__input{border-color:#d4351c}.autocomplete__dropdown-arrow-down{z-index:0;pointer-events:none}
2
- /*# sourceMappingURL=maps/accessible-autocomplete-6.49.0.css.map */
2
+ /*# sourceMappingURL=maps/accessible-autocomplete-6.51.0.css.map */
@@ -2899,15 +2899,34 @@
2899
2899
  window.HMRCAccessibleAutocomplete.enhanceSelectElement(configurationOptions);
2900
2900
  var selectElementAriaDescribedBy = selectElement.getAttribute('aria-describedby') || '';
2901
2901
  var autocompleteElement = document.getElementById(autocompleteId);
2902
- var autocompleteElementAriaDescribedBy = autocompleteElement && autocompleteElement.getAttribute('aria-describedby') || '';
2902
+ var autocompleteElementAriaDescribedBy = (autocompleteElement === null || autocompleteElement === void 0 ? void 0 : autocompleteElement.getAttribute('aria-describedby')) || '';
2903
2903
  var autocompleteElementMissingAriaDescribedAttrs = autocompleteElement && autocompleteElement.tagName !== 'select' && !autocompleteElementAriaDescribedBy.includes(selectElementAriaDescribedBy);
2904
2904
  if (autocompleteElementMissingAriaDescribedAttrs) {
2905
2905
  // if there is a hint and/or error then the autocomplete element
2906
- // needs to be aria-describedby these, which it isn't be default
2907
- // we need to check if it hasn't already been done to avoid
2906
+ // needs to be aria-describedby these, which it isn't be default.
2907
+ // we need to check if it hasn't already been done to avoid adding
2908
+ // them twice if someone has added a separate patch.
2908
2909
  autocompleteElement.setAttribute('aria-describedby', "".concat(selectElementAriaDescribedBy, " ").concat(autocompleteElementAriaDescribedBy));
2910
+ if (window.MutationObserver != null) {
2911
+ // when the input is empty, the autocomplete adds a link to a hint
2912
+ // that explains how to interact with the input via aria-describedby
2913
+ // and when it's not empty it removes it. These changes cause the
2914
+ // removal of the links to the error and hint, so we need to add
2915
+ // those links back, as well as maintain the link to the hint if it
2916
+ // was present because the input is empty.
2917
+ new MutationObserver(function () {
2918
+ var currentAriaDescribedBy = autocompleteElement.getAttribute('aria-describedby') || '';
2919
+ if (!(currentAriaDescribedBy !== null && currentAriaDescribedBy !== void 0 && currentAriaDescribedBy.includes(selectElementAriaDescribedBy))) {
2920
+ autocompleteElement.setAttribute('aria-describedby', "".concat(selectElementAriaDescribedBy, " ").concat(currentAriaDescribedBy));
2921
+ }
2922
+ }).observe(autocompleteElement, {
2923
+ attributes: true,
2924
+ attributeFilter: ['aria-describedby']
2925
+ });
2926
+ }
2927
+
2909
2928
  // and in case page is still using adam's patch, this should stop
2910
- // the select elements aria described by being added to the
2929
+ // the select elements aria-describedby from being added to the
2911
2930
  // autocomplete element twice when that runs (though unsure if a
2912
2931
  // screen reader would actually announce the elements twice if same
2913
2932
  // element was listed twice in the aria-describedby attribute)
package/hmrc/all.js CHANGED
@@ -489,12 +489,6 @@
489
489
  }
490
490
  });
491
491
  };
492
- var wrapLink = function wrapLink($elem) {
493
- var $wrapper = document.createElement('div');
494
- $wrapper.classList.add('hmrc-timeout-dialog__link-wrapper');
495
- $wrapper.appendChild($elem);
496
- return $wrapper;
497
- };
498
492
  var setupDialog = function setupDialog(signoutTime) {
499
493
  var $element = utils.generateDomElementFromString('<div>');
500
494
  if (settings.title) {
@@ -511,17 +505,20 @@
511
505
  $visualMessge.appendChild(document.createTextNode(" ".concat(settings.messageSuffix)));
512
506
  }
513
507
  var $staySignedInButton = utils.generateDomElementFromStringAndAppendText('<button id="hmrc-timeout-keep-signin-btn" class="govuk-button">', settings.keepAliveButtonText);
508
+ var $wrapper = document.createElement('div');
509
+ $wrapper.classList.add('govuk-button-group');
510
+ $wrapper.appendChild($staySignedInButton);
514
511
  $element.appendChild($visualMessge);
515
512
  $element.appendChild($audibleMessage);
516
- $element.appendChild($staySignedInButton);
517
513
  $staySignedInButton.addEventListener('click', keepAliveAndClose);
518
514
  $element.appendChild(document.createTextNode(' '));
519
515
  if (!settings.hideSignOutButton) {
520
516
  var $signOutButton = utils.generateDomElementFromStringAndAppendText('<a id="hmrc-timeout-sign-out-link" class="govuk-link hmrc-timeout-dialog__link">', settings.signOutButtonText);
521
517
  $signOutButton.addEventListener('click', signOut);
522
518
  $signOutButton.setAttribute('href', settings.signOutUrl);
523
- $element.appendChild(wrapLink($signOutButton));
519
+ $wrapper.appendChild($signOutButton);
524
520
  }
521
+ $element.appendChild($wrapper);
525
522
  var dialogControl = dialog.displayDialog($element);
526
523
  cleanupFunctions.push(function () {
527
524
  dialogControl.closeDialog();
@@ -52,7 +52,7 @@ AccessibleAutoComplete.prototype.init = function init() {
52
52
 
53
53
  const selectElementAriaDescribedBy = selectElement.getAttribute('aria-describedby') || '';
54
54
  const autocompleteElement = document.getElementById(autocompleteId);
55
- const autocompleteElementAriaDescribedBy = (autocompleteElement && autocompleteElement.getAttribute('aria-describedby')) || '';
55
+ const autocompleteElementAriaDescribedBy = (autocompleteElement?.getAttribute('aria-describedby')) || '';
56
56
  const autocompleteElementMissingAriaDescribedAttrs = (
57
57
  autocompleteElement
58
58
  && autocompleteElement.tagName !== 'select'
@@ -60,14 +60,34 @@ AccessibleAutoComplete.prototype.init = function init() {
60
60
  );
61
61
  if (autocompleteElementMissingAriaDescribedAttrs) {
62
62
  // if there is a hint and/or error then the autocomplete element
63
- // needs to be aria-describedby these, which it isn't be default
64
- // we need to check if it hasn't already been done to avoid
63
+ // needs to be aria-describedby these, which it isn't be default.
64
+ // we need to check if it hasn't already been done to avoid adding
65
+ // them twice if someone has added a separate patch.
65
66
  autocompleteElement.setAttribute(
66
67
  'aria-describedby',
67
68
  `${selectElementAriaDescribedBy} ${autocompleteElementAriaDescribedBy}`,
68
69
  );
70
+
71
+ if (window.MutationObserver != null) {
72
+ // when the input is empty, the autocomplete adds a link to a hint
73
+ // that explains how to interact with the input via aria-describedby
74
+ // and when it's not empty it removes it. These changes cause the
75
+ // removal of the links to the error and hint, so we need to add
76
+ // those links back, as well as maintain the link to the hint if it
77
+ // was present because the input is empty.
78
+ new MutationObserver(() => {
79
+ const currentAriaDescribedBy = autocompleteElement.getAttribute('aria-describedby') || '';
80
+ if (!currentAriaDescribedBy?.includes(selectElementAriaDescribedBy)) {
81
+ autocompleteElement.setAttribute('aria-describedby', `${selectElementAriaDescribedBy} ${currentAriaDescribedBy}`);
82
+ }
83
+ }).observe(autocompleteElement, {
84
+ attributes: true,
85
+ attributeFilter: ['aria-describedby'],
86
+ });
87
+ }
88
+
69
89
  // and in case page is still using adam's patch, this should stop
70
- // the select elements aria described by being added to the
90
+ // the select elements aria-describedby from being added to the
71
91
  // autocomplete element twice when that runs (though unsure if a
72
92
  // screen reader would actually announce the elements twice if same
73
93
  // element was listed twice in the aria-describedby attribute)
@@ -40,6 +40,10 @@ html {
40
40
  @include govuk-media-query($from: tablet) {
41
41
  width: 435px;
42
42
  }
43
+
44
+ &:focus {
45
+ outline: $govuk-focus-width solid $govuk-focus-colour;
46
+ }
43
47
  }
44
48
 
45
49
  .hmrc-timeout-dialog__message {
@@ -54,25 +58,13 @@ html {
54
58
  white-space: nowrap;
55
59
  }
56
60
 
57
- .hmrc-timeout-dialog__link-wrapper {
58
- @include govuk-media-query($from: tablet) {
59
- display: inline-block;
60
- line-height: 2.5em;
61
- vertical-align: baseline;
62
- }
63
- }
64
-
65
61
  .hmrc-timeout-dialog__link {
66
62
  @include govuk-font($size: 24);
67
63
 
68
- display: inline-block;
69
-
70
64
  @include govuk-media-query($from: tablet) {
71
65
  @include govuk-font($size: 19);
72
66
 
73
- position: relative;
74
- top: 2px;
75
- padding: 0.526315em 0.789473em 0.263157em;
76
- line-height: 1.5;
67
+ // Same padding as govuk-button
68
+ padding: (govuk-spacing(2) - $govuk-border-width-form-element) govuk-spacing(2) (govuk-spacing(2) - $govuk-border-width-form-element - ($govuk-border-width-form-element / 2));
77
69
  }
78
70
  }
@@ -141,14 +141,6 @@ function TimeoutDialog($module, $sessionActivityService) {
141
141
  });
142
142
  };
143
143
 
144
- const wrapLink = ($elem) => {
145
- const $wrapper = document.createElement('div');
146
- $wrapper.classList.add('hmrc-timeout-dialog__link-wrapper');
147
- $wrapper.appendChild($elem);
148
-
149
- return $wrapper;
150
- };
151
-
152
144
  const setupDialog = (signoutTime) => {
153
145
  const $element = utils.generateDomElementFromString('<div>');
154
146
 
@@ -181,9 +173,12 @@ function TimeoutDialog($module, $sessionActivityService) {
181
173
  settings.keepAliveButtonText,
182
174
  );
183
175
 
176
+ const $wrapper = document.createElement('div');
177
+ $wrapper.classList.add('govuk-button-group');
178
+ $wrapper.appendChild($staySignedInButton);
179
+
184
180
  $element.appendChild($visualMessge);
185
181
  $element.appendChild($audibleMessage);
186
- $element.appendChild($staySignedInButton);
187
182
  $staySignedInButton.addEventListener('click', keepAliveAndClose);
188
183
  $element.appendChild(document.createTextNode(' '));
189
184
 
@@ -195,9 +190,11 @@ function TimeoutDialog($module, $sessionActivityService) {
195
190
  $signOutButton.addEventListener('click', signOut);
196
191
  $signOutButton.setAttribute('href', settings.signOutUrl);
197
192
 
198
- $element.appendChild(wrapLink($signOutButton));
193
+ $wrapper.appendChild($signOutButton);
199
194
  }
200
195
 
196
+ $element.appendChild($wrapper);
197
+
201
198
  const dialogControl = dialog.displayDialog($element);
202
199
 
203
200
  cleanupFunctions.push(() => {