|
1 | | -import dialogPolyfill from 'dialog-polyfill'; |
| 1 | +// import dialogPolyfill from 'dialog-polyfill'; |
2 | 2 |
|
3 | 3 | // TODO revert this back when done fixing errors |
4 | 4 | import { closeMenuState } from '../../_components/navmenu/navmenu'; |
5 | 5 |
|
6 | | -let scrollPosition; |
| 6 | +// let scrollPosition; |
7 | 7 | let lastScrollTop = 0; |
8 | 8 | let st; |
9 | 9 | const body = document.querySelector('body'); |
@@ -58,21 +58,22 @@ const detectOverflowOnMasthead = () => { |
58 | 58 | * @desc adds class to display red banner error stating the menu is too wide |
59 | 59 | */ |
60 | 60 |
|
61 | | -const navContainer = document.querySelector('.b-masthead nav'); |
62 | | -const navMenu = document.querySelector('.nav__menu--top'); |
63 | | -const initialNavMenuWidth = navMenu && navMenu.offsetWidth + 50; |
| 61 | +// const navContainer = document.querySelector('.b-masthead nav'); |
| 62 | +// const navMenu = document.querySelector('.nav__menu--top'); |
| 63 | +// const initialNavMenuWidth = navMenu && navMenu.offsetWidth + 50; |
64 | 64 |
|
65 | 65 | const toggleMobileMenu = () => { |
66 | 66 | if (!mastheadNav) return; |
67 | 67 |
|
68 | 68 | const mastheadClassList = mastheadNavIcon.parentNode.classList; |
69 | | - const navContainerWidth = mastheadClassList.contains('u-hide-l') |
70 | | - ? navContainer.offsetWidth |
71 | | - : navContainer.offsetWidth + 52; |
| 69 | + // const navContainerWidth = mastheadClassList.contains('u-hide-l') |
| 70 | + // ? navContainer.offsetWidth |
| 71 | + // : navContainer.offsetWidth + 52; |
72 | 72 |
|
73 | 73 | // capture div width and compare against window width |
74 | 74 | // TODO: aria expanded stays at true when nav comes back into view, this causes the grey bg on buttons with submenus |
75 | | - if (initialNavMenuWidth >= navContainerWidth || window.innerWidth <= 760) { |
| 75 | + // if (initialNavMenuWidth >= navContainerWidth || window.innerWidth <= 760) { |
| 76 | + if (window.innerWidth <= 760) { |
76 | 77 | // Moves nav to mobile dialogue in footer |
77 | 78 | modalMenu.appendChild(mastheadNav); |
78 | 79 |
|
@@ -244,15 +245,15 @@ const handleResize = () => { |
244 | 245 | * @desc init function for the masthead functionality |
245 | 246 | */ |
246 | 247 | const handleLoading = () => { |
247 | | - window.addEventListener( |
248 | | - 'load', |
249 | | - () => { |
250 | | - toggleMobileMenu(); |
251 | | - toggleAppendMenu(); |
252 | | - closeMenuState(); |
253 | | - }, |
254 | | - false |
255 | | - ); |
| 248 | + // window.addEventListener( |
| 249 | + // 'load', |
| 250 | + // () => { |
| 251 | + toggleMobileMenu(); |
| 252 | + toggleAppendMenu(); |
| 253 | + closeMenuState(); |
| 254 | + // }, |
| 255 | + // false |
| 256 | + // ); |
256 | 257 | }; |
257 | 258 |
|
258 | 259 | const handleClick = () => { |
@@ -306,9 +307,9 @@ const handleKeyPress = () => { |
306 | 307 | */ |
307 | 308 | const Masthead = () => { |
308 | 309 | if (!masthead) return; |
| 310 | + handleLoading(); |
309 | 311 | handleScroll(); |
310 | 312 | handleResize(); |
311 | | - handleLoading(); |
312 | 313 | handleClick(); |
313 | 314 | handleKeyPress(); |
314 | 315 | }; |
|
0 commit comments