hmrc-frontend 2.7.0 → 3.2.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/check-compatibility.js +3 -3
- package/hmrc/VERSION.txt +1 -1
- package/hmrc/all.js +1 -143
- package/hmrc/components/account-menu/README.md +2 -4
- package/hmrc/components/account-menu/_account-menu.scss +2 -134
- package/hmrc/components/account-menu/account-menu.js +1 -163
- package/hmrc/components/account-menu/template.njk +2 -28
- package/hmrc/components/banner/_banner.scss +11 -5
- package/hmrc/components/banner/template.njk +18 -0
- package/hmrc/hmrc-frontend-3.2.0.min.css +4 -0
- package/hmrc/hmrc-frontend-3.2.0.min.js +3 -0
- package/hmrc/hmrc-frontend-ie8-3.2.0.min.css +2 -0
- package/hmrc/maps/hmrc-frontend-3.2.0.min.css.map +1 -0
- package/hmrc/maps/hmrc-frontend-3.2.0.min.js.map +1 -0
- package/hmrc/maps/hmrc-frontend-ie8-3.2.0.min.css.map +1 -0
- package/package.json +2 -2
- package/hmrc/hmrc-frontend-2.7.0.min.css +0 -4
- package/hmrc/hmrc-frontend-2.7.0.min.js +0 -3
- package/hmrc/hmrc-frontend-ie8-2.7.0.min.css +0 -2
- package/hmrc/maps/hmrc-frontend-2.7.0.min.css.map +0 -1
- package/hmrc/maps/hmrc-frontend-2.7.0.min.js.map +0 -1
- package/hmrc/maps/hmrc-frontend-ie8-2.7.0.min.css.map +0 -1
package/check-compatibility.js
CHANGED
|
@@ -14,11 +14,11 @@ if (!knownPrototypeKitNames.includes(consumerPackageJson.name)) {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
const compatibility = {
|
|
17
|
-
2
|
|
18
|
-
'prototype-kit': ['9.14', '9.13', '9.12', '9.11', '9.10', '9.9', '9.8', '9.7', '9.6', '9.5', '9.4', '9.3', '9.2', '9.1', '9.0'],
|
|
17
|
+
3.2: {
|
|
18
|
+
'prototype-kit': ['11.0', '10.0', '9.15', '9.14', '9.13', '9.12', '9.11', '9.10', '9.9', '9.8', '9.7', '9.6', '9.5', '9.4', '9.3', '9.2', '9.1', '9.0'],
|
|
19
19
|
},
|
|
20
20
|
1.38: {
|
|
21
|
-
'prototype-kit': ['9.14', '9.13', '9.12', '9.11', '9.10', '9.9', '9.8', '9.7', '9.6', '9.5', '9.4', '9.3', '9.2', '9.1', '9.0'],
|
|
21
|
+
'prototype-kit': ['11.0', '10.0', '9.15', '9.14', '9.13', '9.12', '9.11', '9.10', '9.9', '9.8', '9.7', '9.6', '9.5', '9.4', '9.3', '9.2', '9.1', '9.0'],
|
|
22
22
|
},
|
|
23
23
|
0.6: {
|
|
24
24
|
'prototype-kit': ['8.12', '8.11', '8.10', '8.9', '8.8', '8.7'],
|
package/hmrc/VERSION.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
3.2.0
|
package/hmrc/all.js
CHANGED
|
@@ -861,21 +861,12 @@
|
|
|
861
861
|
this.$module = document.querySelector($module);
|
|
862
862
|
this.$moduleBottomMargin = this.$module.style.marginBottom;
|
|
863
863
|
this.$mainNav = this.$module.querySelector('.hmrc-account-menu__main');
|
|
864
|
-
this.$subNav = this.$module.querySelector('.hmrc-subnav');
|
|
865
|
-
this.$showSubnavLink = this.$module.querySelector('#account-menu__main-2');
|
|
866
864
|
this.$showNavLinkMobile = this.$module.querySelector('.hmrc-account-menu__link--menu');
|
|
867
|
-
this.$backLink = this.$module.querySelector('.hmrc-account-menu__link--back a');
|
|
868
865
|
this.$currentBreakpoint = getCurrentBreakpoint();
|
|
869
866
|
}
|
|
870
867
|
|
|
871
868
|
AccountMenu.prototype.init = function init() {
|
|
872
869
|
this.setup();
|
|
873
|
-
this.$showSubnavLink.addEventListener('click', this.eventHandlers.showSubnavLinkClick.bind(this));
|
|
874
|
-
this.$showSubnavLink.addEventListener('focusout', this.eventHandlers.showSubnavLinkFocusOut.bind(this));
|
|
875
|
-
this.$showSubnavLink.addEventListener('focusin', this.eventHandlers.showSubnavLinkFocusIn.bind(this));
|
|
876
|
-
this.$backLink.addEventListener('click', this.eventHandlers.backLinkClick.bind(this));
|
|
877
|
-
this.$subNav.addEventListener('focusout', this.eventHandlers.subNavFocusOut.bind(this));
|
|
878
|
-
this.$subNav.addEventListener('focusin', this.eventHandlers.subNavFocusIn.bind(this));
|
|
879
870
|
this.$showNavLinkMobile.addEventListener('click', this.eventHandlers.showNavLinkMobileClick.bind(this));
|
|
880
871
|
window.addEventListener('resize', debounce(this.reinstantiate.bind(this)));
|
|
881
872
|
};
|
|
@@ -891,55 +882,11 @@
|
|
|
891
882
|
};
|
|
892
883
|
|
|
893
884
|
AccountMenu.prototype.eventHandlers = {
|
|
894
|
-
showSubnavLinkClick: function showSubnavLinkClick(event) {
|
|
895
|
-
event.preventDefault();
|
|
896
|
-
event.stopPropagation();
|
|
897
|
-
|
|
898
|
-
if (isSmall(window)) {
|
|
899
|
-
// TODO: remove redundant check - showSubnavLink appears only when subnav is not expanded
|
|
900
|
-
if (!event.currentTarget.classList.contains('hmrc-account-menu__link--more-expanded')) {
|
|
901
|
-
this.hideMainNavMobile(event.currentTarget);
|
|
902
|
-
this.showSubnavMobile(event.currentTarget);
|
|
903
|
-
}
|
|
904
|
-
} else if (event.currentTarget.classList.contains('hmrc-account-menu__link--more-expanded')) {
|
|
905
|
-
this.hideSubnavDesktop();
|
|
906
|
-
} else {
|
|
907
|
-
this.showSubnavDesktop();
|
|
908
|
-
}
|
|
909
|
-
},
|
|
910
|
-
showSubnavLinkFocusOut: function showSubnavLinkFocusOut(event) {
|
|
911
|
-
if (!isSmall(window)) {
|
|
912
|
-
this.$module.querySelector(event.target.hash).dataset.subMenuTimer = setTimeout(function () {}, 0);
|
|
913
|
-
}
|
|
914
|
-
},
|
|
915
|
-
showSubnavLinkFocusIn: function showSubnavLinkFocusIn(event) {
|
|
916
|
-
if (!isSmall(window)) {
|
|
917
|
-
clearTimeout(this.$module.querySelector(event.target.hash).dataset.subMenuTimer);
|
|
918
|
-
}
|
|
919
|
-
},
|
|
920
|
-
backLinkClick: function backLinkClick(event) {
|
|
921
|
-
event.preventDefault(); // TODO: remove redundant check - backlink appears only when subnav is open
|
|
922
|
-
|
|
923
|
-
if (this.$mainNav.classList.contains('hmrc-subnav-is-open')) {
|
|
924
|
-
this.hideSubnavMobile();
|
|
925
|
-
this.showMainNavMobile();
|
|
926
|
-
}
|
|
927
|
-
},
|
|
928
|
-
subNavFocusOut: function subNavFocusOut(event) {
|
|
929
|
-
if (!isSmall(window)) {
|
|
930
|
-
// eslint-disable-next-line no-param-reassign
|
|
931
|
-
event.currentTarget.dataset.subMenuTimer = setTimeout(this.hideSubnavDesktop.bind(this), 0);
|
|
932
|
-
}
|
|
933
|
-
},
|
|
934
|
-
subNavFocusIn: function subNavFocusIn(event) {
|
|
935
|
-
clearTimeout(event.currentTarget.dataset.subMenuTimer);
|
|
936
|
-
},
|
|
937
885
|
showNavLinkMobileClick: function showNavLinkMobileClick(event) {
|
|
938
886
|
event.preventDefault();
|
|
939
887
|
|
|
940
888
|
if (isSmall(window)) {
|
|
941
|
-
if (this.$mainNav.classList.contains('
|
|
942
|
-
this.hideSubnavMobile();
|
|
889
|
+
if (this.$mainNav.classList.contains('main-nav-is-open')) {
|
|
943
890
|
this.hideMainNavMobile(event.currentTarget);
|
|
944
891
|
} else {
|
|
945
892
|
this.showMainNavMobile();
|
|
@@ -949,55 +896,21 @@
|
|
|
949
896
|
};
|
|
950
897
|
|
|
951
898
|
AccountMenu.prototype.setup = function setup() {
|
|
952
|
-
this.$subNav.setAttribute('aria-hidden', 'true');
|
|
953
|
-
this.$subNav.setAttribute('tabindex', '-1');
|
|
954
|
-
this.$showSubnavLink.setAttribute('aria-controls', this.$showSubnavLink.hash.substr(1));
|
|
955
|
-
this.$showSubnavLink.setAttribute('aria-expanded', 'false');
|
|
956
|
-
|
|
957
899
|
if (isSmall(window)) {
|
|
958
900
|
this.$module.classList.add('is-smaller');
|
|
959
901
|
this.$showNavLinkMobile.setAttribute('aria-hidden', 'false');
|
|
960
902
|
this.$showNavLinkMobile.removeAttribute('tabindex');
|
|
961
903
|
this.$showNavLinkMobile.classList.remove('js-hidden');
|
|
962
|
-
this.hideSubnavMobile();
|
|
963
904
|
this.hideMainNavMobile(this.$showNavLinkMobile);
|
|
964
905
|
} else {
|
|
965
906
|
this.$module.classList.remove('is-smaller');
|
|
966
907
|
this.$mainNav.classList.remove('main-nav-is-open', 'js-hidden');
|
|
967
|
-
this.$subNav.classList.remove('js-hidden');
|
|
968
908
|
this.$showNavLinkMobile.setAttribute('aria-hidden', 'true');
|
|
969
909
|
this.$showNavLinkMobile.setAttribute('tabindex', '-1');
|
|
970
910
|
this.$showNavLinkMobile.classList.add('js-hidden');
|
|
971
911
|
}
|
|
972
912
|
};
|
|
973
913
|
|
|
974
|
-
AccountMenu.prototype.showSubnavDesktop = function showSubnavDesktop() {
|
|
975
|
-
var self = this;
|
|
976
|
-
this.$module.classList.add('hmrc-subnav-is-open');
|
|
977
|
-
this.$mainNav.classList.add('hmrc-subnav-is-open');
|
|
978
|
-
this.$subNav.classList.add('hmrc-subnav-reveal');
|
|
979
|
-
this.$subNav.setAttribute('aria-hidden', 'false');
|
|
980
|
-
this.$subNav.setAttribute('aria-expanded', 'true');
|
|
981
|
-
var subNavHeight = this.$subNav.offsetHeight;
|
|
982
|
-
this.$module.style.marginBottom = "".concat(subNavHeight, "px");
|
|
983
|
-
setTimeout(function () {
|
|
984
|
-
self.$subNav.focus();
|
|
985
|
-
}, 500);
|
|
986
|
-
this.$showSubnavLink.classList.add('hmrc-account-menu__link--more-expanded');
|
|
987
|
-
this.$showSubnavLink.setAttribute('aria-expanded', 'true');
|
|
988
|
-
};
|
|
989
|
-
|
|
990
|
-
AccountMenu.prototype.hideSubnavDesktop = function hideSubnavDesktop() {
|
|
991
|
-
this.$module.classList.remove('main-nav-is-open', 'hmrc-subnav-is-open');
|
|
992
|
-
this.$mainNav.classList.remove('hmrc-subnav-is-open');
|
|
993
|
-
this.$subNav.classList.remove('hmrc-subnav-reveal');
|
|
994
|
-
this.$subNav.setAttribute('aria-hidden', 'true');
|
|
995
|
-
this.$subNav.setAttribute('aria-expanded', 'false');
|
|
996
|
-
this.$showSubnavLink.classList.remove('hmrc-account-menu__link--more-expanded');
|
|
997
|
-
this.$showSubnavLink.setAttribute('aria-expanded', 'false');
|
|
998
|
-
this.$module.style.marginBottom = this.$moduleBottomMargin;
|
|
999
|
-
};
|
|
1000
|
-
|
|
1001
914
|
AccountMenu.prototype.showMainNavMobile = function showMainNavMobile() {
|
|
1002
915
|
// TODO: shall we add main-nav-is-open to `nav`????
|
|
1003
916
|
this.$mainNav.classList.remove('js-hidden');
|
|
@@ -1012,64 +925,9 @@
|
|
|
1012
925
|
this.$mainNav.setAttribute('aria-expanded', 'false');
|
|
1013
926
|
|
|
1014
927
|
if (element.classList.contains('hmrc-account-menu__link--menu')) {
|
|
1015
|
-
this.$mainNav.classList.remove('hmrc-subnav-is-open');
|
|
1016
928
|
this.$mainNav.classList.add('js-hidden');
|
|
1017
929
|
this.$showNavLinkMobile.setAttribute('aria-expanded', 'false');
|
|
1018
930
|
this.$showNavLinkMobile.classList.remove('hmrc-account-home--account--is-open');
|
|
1019
|
-
} else if (element.classList.contains('hmrc-account-menu__link--more')) {
|
|
1020
|
-
this.$mainNav.classList.add('hmrc-subnav-is-open');
|
|
1021
|
-
}
|
|
1022
|
-
};
|
|
1023
|
-
|
|
1024
|
-
AccountMenu.prototype.showSubnavMobile = function showSubnavMobile(element) {
|
|
1025
|
-
this.$module.classList.add('hmrc-subnav-is-open');
|
|
1026
|
-
this.$mainNav.classList.remove('main-nav-is-open');
|
|
1027
|
-
this.$mainNav.classList.add('hmrc-subnav-is-open');
|
|
1028
|
-
this.$subNav.classList.remove('js-hidden');
|
|
1029
|
-
this.$subNav.classList.add('hmrc-subnav-reveal');
|
|
1030
|
-
this.$subNav.setAttribute('aria-hidden', 'false');
|
|
1031
|
-
this.$subNav.setAttribute('aria-expanded', 'true');
|
|
1032
|
-
this.$showSubnavLink.classList.add('hmrc-account-menu__link--more-expanded');
|
|
1033
|
-
this.$showSubnavLink.setAttribute('aria-expanded', 'true');
|
|
1034
|
-
this.$backLink.parentNode.setAttribute('aria-hidden', 'false');
|
|
1035
|
-
this.$backLink.removeAttribute('tabindex');
|
|
1036
|
-
this.$backLink.parentNode.classList.remove('hidden');
|
|
1037
|
-
element.parentNode.classList.add('active-subnav-parent'); // TODO: modernise the following and polyfill it for IE8
|
|
1038
|
-
|
|
1039
|
-
var $elementSiblings = element.parentNode.parentNode.children;
|
|
1040
|
-
|
|
1041
|
-
for (var i = 0; i < $elementSiblings.length; i += 1) {
|
|
1042
|
-
var sibling = $elementSiblings[i];
|
|
1043
|
-
|
|
1044
|
-
if (sibling !== this.$backLink.parentNode && sibling !== element.parentNode) {
|
|
1045
|
-
sibling.classList.add('hidden');
|
|
1046
|
-
}
|
|
1047
|
-
}
|
|
1048
|
-
};
|
|
1049
|
-
|
|
1050
|
-
AccountMenu.prototype.hideSubnavMobile = function hideSubnavMobile() {
|
|
1051
|
-
this.$module.classList.remove('hmrc-subnav-is-open');
|
|
1052
|
-
this.$mainNav.classList.remove('hmrc-subnav-is-open');
|
|
1053
|
-
this.$mainNav.classList.add('main-nav-is-open');
|
|
1054
|
-
this.$subNav.classList.add('js-hidden');
|
|
1055
|
-
this.$subNav.classList.remove('hmrc-subnav-reveal');
|
|
1056
|
-
this.$subNav.setAttribute('aria-hidden', 'true');
|
|
1057
|
-
this.$subNav.setAttribute('aria-expanded', 'false');
|
|
1058
|
-
this.$showSubnavLink.classList.remove('hmrc-account-menu__link--more-expanded');
|
|
1059
|
-
this.$showSubnavLink.setAttribute('aria-expanded', 'false');
|
|
1060
|
-
this.$backLink.parentNode.setAttribute('aria-hidden', 'true');
|
|
1061
|
-
this.$backLink.setAttribute('tabindex', '-1');
|
|
1062
|
-
this.$backLink.parentNode.classList.add('hidden');
|
|
1063
|
-
this.$showSubnavLink.parentNode.classList.remove('active-subnav-parent'); // TODO: modernise the following and polyfill it for IE8
|
|
1064
|
-
|
|
1065
|
-
var $backLinkSiblings = this.$backLink.parentNode.parentNode.children;
|
|
1066
|
-
|
|
1067
|
-
for (var i = 0; i < $backLinkSiblings.length; i += 1) {
|
|
1068
|
-
var sibling = $backLinkSiblings[i];
|
|
1069
|
-
|
|
1070
|
-
if (sibling !== this.$backLink.parentNode) {
|
|
1071
|
-
sibling.classList.remove('hidden');
|
|
1072
|
-
}
|
|
1073
931
|
}
|
|
1074
932
|
};
|
|
1075
933
|
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
# HMRC Account Menu
|
|
2
2
|
|
|
3
|
+
This component was updated in PLATUI-1419 to match current implementation used by PTA.
|
|
4
|
+
|
|
3
5
|
## Basic functionality
|
|
4
6
|
|
|
5
7
|
- if the viewport is small, show the extra menu link (showNavLinkMobile)
|
|
6
8
|
- if showNavLinkMobile is triggered, open the main nav (subNav)
|
|
7
|
-
- if menusSub is open, add `is-open` to the nav container (nav)
|
|
8
9
|
- if a menu link (accountLink) is triggered, close sub-nav (subNav)
|
|
9
|
-
- if a menu link with sub-nav (showSubnavLink) is triggered, open it
|
|
10
|
-
- if a sub-nav is open, add `is-open` to nav
|
|
11
10
|
- if showNavLinkMobile is open, close it when triggered
|
|
12
|
-
- if a menu link with sub-nav (showSubnavLink) is open, close it when triggered
|
|
13
11
|
|
|
14
12
|
This code is open source software licensed under the [Apache 2.0 License]("http://www.apache.org/licenses/LICENSE-2.0.html").
|
|
@@ -49,10 +49,6 @@ $hmrc-transition-type: "all";
|
|
|
49
49
|
transition: #{$hmrc-transition-type} $hmrc-account-menu-transition-time ease-in-out;
|
|
50
50
|
border-bottom: 1px solid govuk-colour("mid-grey");
|
|
51
51
|
background-color: govuk-colour("white");
|
|
52
|
-
|
|
53
|
-
&.hmrc-subnav-is-open {
|
|
54
|
-
margin-bottom: 5em;
|
|
55
|
-
}
|
|
56
52
|
}
|
|
57
53
|
|
|
58
54
|
.is-smaller.hmrc-account-menu {
|
|
@@ -177,8 +173,7 @@ $hmrc-transition-type: "all";
|
|
|
177
173
|
clear: both;
|
|
178
174
|
background-color: govuk-colour("light-grey");
|
|
179
175
|
|
|
180
|
-
&.main-nav-is-open
|
|
181
|
-
&.hmrc-subnav-is-open {
|
|
176
|
+
&.main-nav-is-open {
|
|
182
177
|
position: relative;
|
|
183
178
|
border-top: 1px solid govuk-colour("mid-grey");
|
|
184
179
|
|
|
@@ -212,8 +207,7 @@ $hmrc-transition-type: "all";
|
|
|
212
207
|
overflow: hidden;
|
|
213
208
|
border-bottom: 1px solid govuk-colour("mid-grey");
|
|
214
209
|
|
|
215
|
-
&:last-child
|
|
216
|
-
&.active-subnav-parent {
|
|
210
|
+
&:last-child {
|
|
217
211
|
border-bottom: 0;
|
|
218
212
|
}
|
|
219
213
|
}
|
|
@@ -249,128 +243,6 @@ $hmrc-transition-type: "all";
|
|
|
249
243
|
}
|
|
250
244
|
}
|
|
251
245
|
|
|
252
|
-
.hmrc-subnav {
|
|
253
|
-
@include govuk-font($size: 16);
|
|
254
|
-
@include govuk-clearfix;
|
|
255
|
-
|
|
256
|
-
display: none;
|
|
257
|
-
position: absolute;
|
|
258
|
-
z-index: -1;
|
|
259
|
-
top: -61px;
|
|
260
|
-
left: 0;
|
|
261
|
-
width: 100%;
|
|
262
|
-
border-bottom: 1px solid govuk-colour("mid-grey");
|
|
263
|
-
outline: none;
|
|
264
|
-
//transition: margin .3s ease-in-out;
|
|
265
|
-
background-color: govuk-colour("light-grey");
|
|
266
|
-
|
|
267
|
-
p {
|
|
268
|
-
@include govuk-font($size: 16);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
a {
|
|
272
|
-
text-decoration: none;
|
|
273
|
-
|
|
274
|
-
&:visited {
|
|
275
|
-
color: $govuk-brand-colour;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
&:hover {
|
|
279
|
-
color: govuk-colour("light-blue");
|
|
280
|
-
text-decoration: underline;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
&.hmrc-subnav-reveal {
|
|
285
|
-
display: block;
|
|
286
|
-
top: 48px;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
.is-smaller .hmrc-subnav {
|
|
291
|
-
position: relative;
|
|
292
|
-
z-index: 1;
|
|
293
|
-
top: inherit;
|
|
294
|
-
margin: 0 0 0 10px;
|
|
295
|
-
padding: 0;
|
|
296
|
-
-webkit-transition: none;
|
|
297
|
-
transition: none;
|
|
298
|
-
border-bottom: 0;
|
|
299
|
-
outline: none;
|
|
300
|
-
|
|
301
|
-
&.hmrc-subnav-reveal {
|
|
302
|
-
display: block;
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
.hmrc-subnav .hmrc-subnav__section {
|
|
307
|
-
padding-top: 20px;
|
|
308
|
-
padding-bottom: 20px;
|
|
309
|
-
|
|
310
|
-
&:first-child {
|
|
311
|
-
> p,
|
|
312
|
-
> div {
|
|
313
|
-
padding-right: 15px;
|
|
314
|
-
padding-left: 30px;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
&:nth-child(2) {
|
|
319
|
-
> p,
|
|
320
|
-
> div {
|
|
321
|
-
padding-right: 15px;
|
|
322
|
-
padding-left: 15px;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
&:last-child {
|
|
327
|
-
> p,
|
|
328
|
-
> div {
|
|
329
|
-
padding-right: 30px;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
.is-smaller .hmrc-subnav__section {
|
|
335
|
-
width: 100%;
|
|
336
|
-
margin: 0;
|
|
337
|
-
padding: 1em 0 1em 0;
|
|
338
|
-
border-bottom: 1px solid govuk-colour("mid-grey");
|
|
339
|
-
|
|
340
|
-
&:last-child {
|
|
341
|
-
border-bottom: 0;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
a:hover {
|
|
345
|
-
color: $govuk-brand-colour;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
&:first-child,
|
|
349
|
-
&:nth-child(2),
|
|
350
|
-
&:last-child {
|
|
351
|
-
> p,
|
|
352
|
-
> div a {
|
|
353
|
-
padding-right: 0;
|
|
354
|
-
padding-left: 0;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
.hmrc-subnav__section__heading {
|
|
360
|
-
@include govuk-font(16, $weight: bold);
|
|
361
|
-
|
|
362
|
-
margin: 0;
|
|
363
|
-
padding-bottom: 5px;
|
|
364
|
-
font-weight: 400;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
.is-smaller .hmrc-subnav__section__heading {
|
|
368
|
-
@include govuk-font(16, $weight: bold);
|
|
369
|
-
|
|
370
|
-
margin-bottom: 7px;
|
|
371
|
-
font-weight: 600;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
246
|
.js-enabled .hmrc-account-menu__link--menu,
|
|
375
247
|
.js-enabled .is-smaller .hmrc-account-menu__link--more {
|
|
376
248
|
background-image: url("#{$hmrc-assets-path}components/account-menu/images/icon-chevron-right.svg");
|
|
@@ -448,10 +320,6 @@ $hmrc-transition-type: "all";
|
|
|
448
320
|
display: inline;
|
|
449
321
|
}
|
|
450
322
|
}
|
|
451
|
-
|
|
452
|
-
.hmrc-subnav {
|
|
453
|
-
position: static;
|
|
454
|
-
}
|
|
455
323
|
}
|
|
456
324
|
|
|
457
325
|
$hmrc-banner-blue: #005ea5;
|
|
@@ -8,22 +8,13 @@ function AccountMenu($module) {
|
|
|
8
8
|
this.$module = document.querySelector($module);
|
|
9
9
|
this.$moduleBottomMargin = this.$module.style.marginBottom;
|
|
10
10
|
this.$mainNav = this.$module.querySelector('.hmrc-account-menu__main');
|
|
11
|
-
this.$subNav = this.$module.querySelector('.hmrc-subnav');
|
|
12
|
-
this.$showSubnavLink = this.$module.querySelector('#account-menu__main-2');
|
|
13
11
|
this.$showNavLinkMobile = this.$module.querySelector('.hmrc-account-menu__link--menu');
|
|
14
|
-
this.$backLink = this.$module.querySelector('.hmrc-account-menu__link--back a');
|
|
15
12
|
this.$currentBreakpoint = getCurrentBreakpoint();
|
|
16
13
|
}
|
|
17
14
|
|
|
18
15
|
AccountMenu.prototype.init = function init() {
|
|
19
16
|
this.setup();
|
|
20
17
|
|
|
21
|
-
this.$showSubnavLink.addEventListener('click', this.eventHandlers.showSubnavLinkClick.bind(this));
|
|
22
|
-
this.$showSubnavLink.addEventListener('focusout', this.eventHandlers.showSubnavLinkFocusOut.bind(this));
|
|
23
|
-
this.$showSubnavLink.addEventListener('focusin', this.eventHandlers.showSubnavLinkFocusIn.bind(this));
|
|
24
|
-
this.$backLink.addEventListener('click', this.eventHandlers.backLinkClick.bind(this));
|
|
25
|
-
this.$subNav.addEventListener('focusout', this.eventHandlers.subNavFocusOut.bind(this));
|
|
26
|
-
this.$subNav.addEventListener('focusin', this.eventHandlers.subNavFocusIn.bind(this));
|
|
27
18
|
this.$showNavLinkMobile.addEventListener('click', this.eventHandlers.showNavLinkMobileClick.bind(this));
|
|
28
19
|
|
|
29
20
|
window.addEventListener('resize', debounce(this.reinstantiate.bind(this)));
|
|
@@ -39,56 +30,11 @@ AccountMenu.prototype.reinstantiate = function reinstantiate(resizeEvent) {
|
|
|
39
30
|
};
|
|
40
31
|
|
|
41
32
|
AccountMenu.prototype.eventHandlers = {
|
|
42
|
-
showSubnavLinkClick(event) {
|
|
43
|
-
event.preventDefault();
|
|
44
|
-
event.stopPropagation();
|
|
45
|
-
|
|
46
|
-
if (isSmall(window)) {
|
|
47
|
-
// TODO: remove redundant check - showSubnavLink appears only when subnav is not expanded
|
|
48
|
-
if (!event.currentTarget.classList.contains('hmrc-account-menu__link--more-expanded')) {
|
|
49
|
-
this.hideMainNavMobile(event.currentTarget);
|
|
50
|
-
this.showSubnavMobile(event.currentTarget);
|
|
51
|
-
}
|
|
52
|
-
} else if (event.currentTarget.classList.contains('hmrc-account-menu__link--more-expanded')) {
|
|
53
|
-
this.hideSubnavDesktop();
|
|
54
|
-
} else {
|
|
55
|
-
this.showSubnavDesktop();
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
showSubnavLinkFocusOut(event) {
|
|
59
|
-
if (!isSmall(window)) {
|
|
60
|
-
this.$module.querySelector(event.target.hash).dataset.subMenuTimer = setTimeout(() => {}, 0);
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
showSubnavLinkFocusIn(event) {
|
|
64
|
-
if (!isSmall(window)) {
|
|
65
|
-
clearTimeout(this.$module.querySelector(event.target.hash).dataset.subMenuTimer);
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
backLinkClick(event) {
|
|
69
|
-
event.preventDefault();
|
|
70
|
-
|
|
71
|
-
// TODO: remove redundant check - backlink appears only when subnav is open
|
|
72
|
-
if (this.$mainNav.classList.contains('hmrc-subnav-is-open')) {
|
|
73
|
-
this.hideSubnavMobile();
|
|
74
|
-
this.showMainNavMobile();
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
subNavFocusOut(event) {
|
|
78
|
-
if (!isSmall(window)) {
|
|
79
|
-
// eslint-disable-next-line no-param-reassign
|
|
80
|
-
event.currentTarget.dataset.subMenuTimer = setTimeout(this.hideSubnavDesktop.bind(this), 0);
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
subNavFocusIn(event) {
|
|
84
|
-
clearTimeout(event.currentTarget.dataset.subMenuTimer);
|
|
85
|
-
},
|
|
86
33
|
showNavLinkMobileClick(event) {
|
|
87
34
|
event.preventDefault();
|
|
88
35
|
|
|
89
36
|
if (isSmall(window)) {
|
|
90
|
-
if (this.$mainNav.classList.contains('
|
|
91
|
-
this.hideSubnavMobile();
|
|
37
|
+
if (this.$mainNav.classList.contains('main-nav-is-open')) {
|
|
92
38
|
this.hideMainNavMobile(event.currentTarget);
|
|
93
39
|
} else {
|
|
94
40
|
this.showMainNavMobile();
|
|
@@ -98,67 +44,22 @@ AccountMenu.prototype.eventHandlers = {
|
|
|
98
44
|
};
|
|
99
45
|
|
|
100
46
|
AccountMenu.prototype.setup = function setup() {
|
|
101
|
-
this.$subNav.setAttribute('aria-hidden', 'true');
|
|
102
|
-
this.$subNav.setAttribute('tabindex', '-1');
|
|
103
|
-
|
|
104
|
-
this.$showSubnavLink.setAttribute('aria-controls', this.$showSubnavLink.hash.substr(1));
|
|
105
|
-
this.$showSubnavLink.setAttribute('aria-expanded', 'false');
|
|
106
|
-
|
|
107
47
|
if (isSmall(window)) {
|
|
108
48
|
this.$module.classList.add('is-smaller');
|
|
109
49
|
this.$showNavLinkMobile.setAttribute('aria-hidden', 'false');
|
|
110
50
|
this.$showNavLinkMobile.removeAttribute('tabindex');
|
|
111
51
|
this.$showNavLinkMobile.classList.remove('js-hidden');
|
|
112
52
|
|
|
113
|
-
this.hideSubnavMobile();
|
|
114
53
|
this.hideMainNavMobile(this.$showNavLinkMobile);
|
|
115
54
|
} else {
|
|
116
55
|
this.$module.classList.remove('is-smaller');
|
|
117
56
|
this.$mainNav.classList.remove('main-nav-is-open', 'js-hidden');
|
|
118
|
-
this.$subNav.classList.remove('js-hidden');
|
|
119
57
|
this.$showNavLinkMobile.setAttribute('aria-hidden', 'true');
|
|
120
58
|
this.$showNavLinkMobile.setAttribute('tabindex', '-1');
|
|
121
59
|
this.$showNavLinkMobile.classList.add('js-hidden');
|
|
122
60
|
}
|
|
123
61
|
};
|
|
124
62
|
|
|
125
|
-
AccountMenu.prototype.showSubnavDesktop = function showSubnavDesktop() {
|
|
126
|
-
const self = this;
|
|
127
|
-
|
|
128
|
-
this.$module.classList.add('hmrc-subnav-is-open');
|
|
129
|
-
|
|
130
|
-
this.$mainNav.classList.add('hmrc-subnav-is-open');
|
|
131
|
-
|
|
132
|
-
this.$subNav.classList.add('hmrc-subnav-reveal');
|
|
133
|
-
this.$subNav.setAttribute('aria-hidden', 'false');
|
|
134
|
-
this.$subNav.setAttribute('aria-expanded', 'true');
|
|
135
|
-
|
|
136
|
-
const subNavHeight = this.$subNav.offsetHeight;
|
|
137
|
-
this.$module.style.marginBottom = `${subNavHeight}px`;
|
|
138
|
-
|
|
139
|
-
setTimeout(() => {
|
|
140
|
-
self.$subNav.focus();
|
|
141
|
-
}, 500);
|
|
142
|
-
|
|
143
|
-
this.$showSubnavLink.classList.add('hmrc-account-menu__link--more-expanded');
|
|
144
|
-
this.$showSubnavLink.setAttribute('aria-expanded', 'true');
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
AccountMenu.prototype.hideSubnavDesktop = function hideSubnavDesktop() {
|
|
148
|
-
this.$module.classList.remove('main-nav-is-open', 'hmrc-subnav-is-open');
|
|
149
|
-
|
|
150
|
-
this.$mainNav.classList.remove('hmrc-subnav-is-open');
|
|
151
|
-
|
|
152
|
-
this.$subNav.classList.remove('hmrc-subnav-reveal');
|
|
153
|
-
this.$subNav.setAttribute('aria-hidden', 'true');
|
|
154
|
-
this.$subNav.setAttribute('aria-expanded', 'false');
|
|
155
|
-
|
|
156
|
-
this.$showSubnavLink.classList.remove('hmrc-account-menu__link--more-expanded');
|
|
157
|
-
this.$showSubnavLink.setAttribute('aria-expanded', 'false');
|
|
158
|
-
|
|
159
|
-
this.$module.style.marginBottom = this.$moduleBottomMargin;
|
|
160
|
-
};
|
|
161
|
-
|
|
162
63
|
AccountMenu.prototype.showMainNavMobile = function showMainNavMobile() {
|
|
163
64
|
// TODO: shall we add main-nav-is-open to `nav`????
|
|
164
65
|
this.$mainNav.classList.remove('js-hidden');
|
|
@@ -174,73 +75,10 @@ AccountMenu.prototype.hideMainNavMobile = function hideMainNavMobile(element) {
|
|
|
174
75
|
this.$mainNav.setAttribute('aria-expanded', 'false');
|
|
175
76
|
|
|
176
77
|
if (element.classList.contains('hmrc-account-menu__link--menu')) {
|
|
177
|
-
this.$mainNav.classList.remove('hmrc-subnav-is-open');
|
|
178
78
|
this.$mainNav.classList.add('js-hidden');
|
|
179
79
|
|
|
180
80
|
this.$showNavLinkMobile.setAttribute('aria-expanded', 'false');
|
|
181
81
|
this.$showNavLinkMobile.classList.remove('hmrc-account-home--account--is-open');
|
|
182
|
-
} else if (element.classList.contains('hmrc-account-menu__link--more')) {
|
|
183
|
-
this.$mainNav.classList.add('hmrc-subnav-is-open');
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
AccountMenu.prototype.showSubnavMobile = function showSubnavMobile(element) {
|
|
188
|
-
this.$module.classList.add('hmrc-subnav-is-open');
|
|
189
|
-
|
|
190
|
-
this.$mainNav.classList.remove('main-nav-is-open');
|
|
191
|
-
this.$mainNav.classList.add('hmrc-subnav-is-open');
|
|
192
|
-
|
|
193
|
-
this.$subNav.classList.remove('js-hidden');
|
|
194
|
-
this.$subNav.classList.add('hmrc-subnav-reveal');
|
|
195
|
-
this.$subNav.setAttribute('aria-hidden', 'false');
|
|
196
|
-
this.$subNav.setAttribute('aria-expanded', 'true');
|
|
197
|
-
|
|
198
|
-
this.$showSubnavLink.classList.add('hmrc-account-menu__link--more-expanded');
|
|
199
|
-
this.$showSubnavLink.setAttribute('aria-expanded', 'true');
|
|
200
|
-
|
|
201
|
-
this.$backLink.parentNode.setAttribute('aria-hidden', 'false');
|
|
202
|
-
this.$backLink.removeAttribute('tabindex');
|
|
203
|
-
this.$backLink.parentNode.classList.remove('hidden');
|
|
204
|
-
|
|
205
|
-
element.parentNode.classList.add('active-subnav-parent');
|
|
206
|
-
|
|
207
|
-
// TODO: modernise the following and polyfill it for IE8
|
|
208
|
-
const $elementSiblings = element.parentNode.parentNode.children;
|
|
209
|
-
for (let i = 0; i < $elementSiblings.length; i += 1) {
|
|
210
|
-
const sibling = $elementSiblings[i];
|
|
211
|
-
if (sibling !== this.$backLink.parentNode && sibling !== element.parentNode) {
|
|
212
|
-
sibling.classList.add('hidden');
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
AccountMenu.prototype.hideSubnavMobile = function hideSubnavMobile() {
|
|
218
|
-
this.$module.classList.remove('hmrc-subnav-is-open');
|
|
219
|
-
|
|
220
|
-
this.$mainNav.classList.remove('hmrc-subnav-is-open');
|
|
221
|
-
this.$mainNav.classList.add('main-nav-is-open');
|
|
222
|
-
|
|
223
|
-
this.$subNav.classList.add('js-hidden');
|
|
224
|
-
this.$subNav.classList.remove('hmrc-subnav-reveal');
|
|
225
|
-
this.$subNav.setAttribute('aria-hidden', 'true');
|
|
226
|
-
this.$subNav.setAttribute('aria-expanded', 'false');
|
|
227
|
-
|
|
228
|
-
this.$showSubnavLink.classList.remove('hmrc-account-menu__link--more-expanded');
|
|
229
|
-
this.$showSubnavLink.setAttribute('aria-expanded', 'false');
|
|
230
|
-
|
|
231
|
-
this.$backLink.parentNode.setAttribute('aria-hidden', 'true');
|
|
232
|
-
this.$backLink.setAttribute('tabindex', '-1');
|
|
233
|
-
this.$backLink.parentNode.classList.add('hidden');
|
|
234
|
-
|
|
235
|
-
this.$showSubnavLink.parentNode.classList.remove('active-subnav-parent');
|
|
236
|
-
|
|
237
|
-
// TODO: modernise the following and polyfill it for IE8
|
|
238
|
-
const $backLinkSiblings = this.$backLink.parentNode.parentNode.children;
|
|
239
|
-
for (let i = 0; i < $backLinkSiblings.length; i += 1) {
|
|
240
|
-
const sibling = $backLinkSiblings[i];
|
|
241
|
-
if (sibling !== this.$backLink.parentNode) {
|
|
242
|
-
sibling.classList.remove('hidden');
|
|
243
|
-
}
|
|
244
82
|
}
|
|
245
83
|
};
|
|
246
84
|
|
|
@@ -36,35 +36,9 @@
|
|
|
36
36
|
</li>
|
|
37
37
|
|
|
38
38
|
<li>
|
|
39
|
-
<a href="#
|
|
40
|
-
{% if language == 'cy' %}Eich
|
|
39
|
+
<a href="{{ params.yourProfile.href | default('#') }}" class="hmrc-account-menu__link{% if params.yourProfile.active %} hmrc-account-menu__link--active{% endif %}">
|
|
40
|
+
{% if language == 'cy' %}Eich proffil{% else %}Your profile{% endif %}
|
|
41
41
|
</a>
|
|
42
|
-
|
|
43
|
-
<div class="hmrc-subnav" id="subnav-your-account" role="navigation" aria-labelledby="account-menu__main-2" aria-label="Your account">
|
|
44
|
-
<div class="govuk-grid-column-one-third hmrc-subnav__section">
|
|
45
|
-
<p class="hmrc-subnav__section__heading">
|
|
46
|
-
{% if language == 'cy' %}Gosodiadau di-bapur{% else %}Paperless settings{% endif %}
|
|
47
|
-
</p>
|
|
48
|
-
|
|
49
|
-
<div>
|
|
50
|
-
<a href="{{ params.paperlessSettings.href | default('#') }}">
|
|
51
|
-
{% if language == 'cy' %}Rheoli'ch gosodiadau di-bapur{% else %}Manage your paperless settings{% endif %}
|
|
52
|
-
</a>
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
|
|
56
|
-
<div class="govuk-grid-column-one-third hmrc-subnav__section">
|
|
57
|
-
<p class="hmrc-subnav__section__heading">
|
|
58
|
-
{% if language == 'cy' %}Manylion personol{% else %}Personal details{% endif %}
|
|
59
|
-
</p>
|
|
60
|
-
|
|
61
|
-
<div>
|
|
62
|
-
<a href="{{ params.personalDetails.href | default('#') }}">
|
|
63
|
-
{% if language == 'cy' %}Rheoli'ch manylion personol{% else %}Manage your personal details{% endif %}
|
|
64
|
-
</a>
|
|
65
|
-
</div>
|
|
66
|
-
</div>
|
|
67
|
-
</div>
|
|
68
42
|
</li>
|
|
69
43
|
|
|
70
44
|
<li>
|