Issue #3111409 by mherchel, proeung, larowlan, alexpott, lauriii, Gábor Hojtsy, andrewmacpherson, catch, xjm, andypost, rahulrasgon, rabbitlair, mrconnerton, poojakural, boulaffasae, jerseycheese, shimpy, Indrajith KB, DuneBL, kiran.kadam911, komalkolekar, keboca, hawkeye.twolf, andrewozone, Maithri Shetty, alexdmccabe, sd9121, Sreenivas Bttv, katannshaw, mgifford, nod_, webchick, mtift, rainbreaw, Berdir, brianperry, thejimbirch, Dom., q0rban, nitesh624, hansa11, himanshu_sindhwani, kostyashupenko, shaktik, bnjmnm, sharma.amitt16, sonam.chaturvedi, steinmb, shaal, ressa, Ramya Balasubramanian, Sebacic, pradeepjha, tanmaykadam, thedrupalkid, vinitk, volkswagenchick, viappidu, vebrovski, Ujval Shah, Webbeh, Yuri, trebormc, msuthars, mrinalini9, bash247, chetanbharambe, ellenoise, anevins, andriyun, CocoM, JayKandari, ambuj_gupta, hussainweb, jhodgdon, Pooja Ganjage, ju.vanderw, jwitkowski79, MaxPah, Lokender Singh2, jponch, KarenS, KarinG, Lal_: Add new Olivero frontend theme to Drupal 9.1 core as beta; later make it stable and the default
2020-10-16 09:43:55 +00:00
|
|
|
/**
|
|
|
|
* DO NOT EDIT THIS FILE.
|
|
|
|
* See the following change record for more information,
|
|
|
|
* https://www.drupal.org/node/2815083
|
|
|
|
* @preserve
|
|
|
|
**/
|
|
|
|
|
2021-04-09 11:34:27 +00:00
|
|
|
(function (Drupal, once, tabbable) {
|
Issue #3111409 by mherchel, proeung, larowlan, alexpott, lauriii, Gábor Hojtsy, andrewmacpherson, catch, xjm, andypost, rahulrasgon, rabbitlair, mrconnerton, poojakural, boulaffasae, jerseycheese, shimpy, Indrajith KB, DuneBL, kiran.kadam911, komalkolekar, keboca, hawkeye.twolf, andrewozone, Maithri Shetty, alexdmccabe, sd9121, Sreenivas Bttv, katannshaw, mgifford, nod_, webchick, mtift, rainbreaw, Berdir, brianperry, thejimbirch, Dom., q0rban, nitesh624, hansa11, himanshu_sindhwani, kostyashupenko, shaktik, bnjmnm, sharma.amitt16, sonam.chaturvedi, steinmb, shaal, ressa, Ramya Balasubramanian, Sebacic, pradeepjha, tanmaykadam, thedrupalkid, vinitk, volkswagenchick, viappidu, vebrovski, Ujval Shah, Webbeh, Yuri, trebormc, msuthars, mrinalini9, bash247, chetanbharambe, ellenoise, anevins, andriyun, CocoM, JayKandari, ambuj_gupta, hussainweb, jhodgdon, Pooja Ganjage, ju.vanderw, jwitkowski79, MaxPah, Lokender Singh2, jponch, KarenS, KarinG, Lal_: Add new Olivero frontend theme to Drupal 9.1 core as beta; later make it stable and the default
2020-10-16 09:43:55 +00:00
|
|
|
function isNavOpen(navWrapper) {
|
|
|
|
return navWrapper.classList.contains('is-active');
|
|
|
|
}
|
|
|
|
|
|
|
|
function toggleNav(props, state) {
|
|
|
|
var value = !!state;
|
|
|
|
props.navButton.setAttribute('aria-expanded', value);
|
|
|
|
|
|
|
|
if (value) {
|
|
|
|
props.body.classList.add('js-overlay-active');
|
|
|
|
props.body.classList.add('js-fixed');
|
|
|
|
props.navWrapper.classList.add('is-active');
|
|
|
|
} else {
|
|
|
|
props.body.classList.remove('js-overlay-active');
|
|
|
|
props.body.classList.remove('js-fixed');
|
|
|
|
props.navWrapper.classList.remove('is-active');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function init(props) {
|
|
|
|
props.navButton.setAttribute('aria-controls', props.navWrapperId);
|
|
|
|
props.navButton.setAttribute('aria-expanded', 'false');
|
|
|
|
props.navButton.addEventListener('click', function () {
|
|
|
|
toggleNav(props, !isNavOpen(props.navWrapper));
|
|
|
|
});
|
|
|
|
document.addEventListener('keyup', function (e) {
|
2021-06-29 07:34:56 +00:00
|
|
|
if (e.key === 'Escape' || e.key === 'Esc') {
|
Issue #3111409 by mherchel, proeung, larowlan, alexpott, lauriii, Gábor Hojtsy, andrewmacpherson, catch, xjm, andypost, rahulrasgon, rabbitlair, mrconnerton, poojakural, boulaffasae, jerseycheese, shimpy, Indrajith KB, DuneBL, kiran.kadam911, komalkolekar, keboca, hawkeye.twolf, andrewozone, Maithri Shetty, alexdmccabe, sd9121, Sreenivas Bttv, katannshaw, mgifford, nod_, webchick, mtift, rainbreaw, Berdir, brianperry, thejimbirch, Dom., q0rban, nitesh624, hansa11, himanshu_sindhwani, kostyashupenko, shaktik, bnjmnm, sharma.amitt16, sonam.chaturvedi, steinmb, shaal, ressa, Ramya Balasubramanian, Sebacic, pradeepjha, tanmaykadam, thedrupalkid, vinitk, volkswagenchick, viappidu, vebrovski, Ujval Shah, Webbeh, Yuri, trebormc, msuthars, mrinalini9, bash247, chetanbharambe, ellenoise, anevins, andriyun, CocoM, JayKandari, ambuj_gupta, hussainweb, jhodgdon, Pooja Ganjage, ju.vanderw, jwitkowski79, MaxPah, Lokender Singh2, jponch, KarenS, KarinG, Lal_: Add new Olivero frontend theme to Drupal 9.1 core as beta; later make it stable and the default
2020-10-16 09:43:55 +00:00
|
|
|
if (props.olivero.areAnySubNavsOpen()) {
|
|
|
|
props.olivero.closeAllSubNav();
|
|
|
|
} else {
|
|
|
|
toggleNav(props, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
props.overlay.addEventListener('click', function () {
|
|
|
|
toggleNav(props, false);
|
|
|
|
});
|
|
|
|
props.overlay.addEventListener('touchstart', function () {
|
|
|
|
toggleNav(props, false);
|
|
|
|
});
|
2021-04-09 11:34:27 +00:00
|
|
|
props.header.addEventListener('keydown', function (e) {
|
|
|
|
if (e.key === 'Tab' && isNavOpen(props.navWrapper)) {
|
|
|
|
var tabbableNavElements = tabbable.tabbable(props.navWrapper);
|
|
|
|
tabbableNavElements.unshift(props.navButton);
|
|
|
|
var firstTabbableEl = tabbableNavElements[0];
|
|
|
|
var lastTabbableEl = tabbableNavElements[tabbableNavElements.length - 1];
|
|
|
|
|
Issue #3111409 by mherchel, proeung, larowlan, alexpott, lauriii, Gábor Hojtsy, andrewmacpherson, catch, xjm, andypost, rahulrasgon, rabbitlair, mrconnerton, poojakural, boulaffasae, jerseycheese, shimpy, Indrajith KB, DuneBL, kiran.kadam911, komalkolekar, keboca, hawkeye.twolf, andrewozone, Maithri Shetty, alexdmccabe, sd9121, Sreenivas Bttv, katannshaw, mgifford, nod_, webchick, mtift, rainbreaw, Berdir, brianperry, thejimbirch, Dom., q0rban, nitesh624, hansa11, himanshu_sindhwani, kostyashupenko, shaktik, bnjmnm, sharma.amitt16, sonam.chaturvedi, steinmb, shaal, ressa, Ramya Balasubramanian, Sebacic, pradeepjha, tanmaykadam, thedrupalkid, vinitk, volkswagenchick, viappidu, vebrovski, Ujval Shah, Webbeh, Yuri, trebormc, msuthars, mrinalini9, bash247, chetanbharambe, ellenoise, anevins, andriyun, CocoM, JayKandari, ambuj_gupta, hussainweb, jhodgdon, Pooja Ganjage, ju.vanderw, jwitkowski79, MaxPah, Lokender Singh2, jponch, KarenS, KarinG, Lal_: Add new Olivero frontend theme to Drupal 9.1 core as beta; later make it stable and the default
2020-10-16 09:43:55 +00:00
|
|
|
if (e.shiftKey) {
|
2021-04-09 11:34:27 +00:00
|
|
|
if (document.activeElement === firstTabbableEl && !props.olivero.isDesktopNav()) {
|
|
|
|
lastTabbableEl.focus();
|
Issue #3111409 by mherchel, proeung, larowlan, alexpott, lauriii, Gábor Hojtsy, andrewmacpherson, catch, xjm, andypost, rahulrasgon, rabbitlair, mrconnerton, poojakural, boulaffasae, jerseycheese, shimpy, Indrajith KB, DuneBL, kiran.kadam911, komalkolekar, keboca, hawkeye.twolf, andrewozone, Maithri Shetty, alexdmccabe, sd9121, Sreenivas Bttv, katannshaw, mgifford, nod_, webchick, mtift, rainbreaw, Berdir, brianperry, thejimbirch, Dom., q0rban, nitesh624, hansa11, himanshu_sindhwani, kostyashupenko, shaktik, bnjmnm, sharma.amitt16, sonam.chaturvedi, steinmb, shaal, ressa, Ramya Balasubramanian, Sebacic, pradeepjha, tanmaykadam, thedrupalkid, vinitk, volkswagenchick, viappidu, vebrovski, Ujval Shah, Webbeh, Yuri, trebormc, msuthars, mrinalini9, bash247, chetanbharambe, ellenoise, anevins, andriyun, CocoM, JayKandari, ambuj_gupta, hussainweb, jhodgdon, Pooja Ganjage, ju.vanderw, jwitkowski79, MaxPah, Lokender Singh2, jponch, KarenS, KarinG, Lal_: Add new Olivero frontend theme to Drupal 9.1 core as beta; later make it stable and the default
2020-10-16 09:43:55 +00:00
|
|
|
e.preventDefault();
|
|
|
|
}
|
2021-04-09 11:34:27 +00:00
|
|
|
} else if (document.activeElement === lastTabbableEl && !props.olivero.isDesktopNav()) {
|
|
|
|
firstTabbableEl.focus();
|
Issue #3111409 by mherchel, proeung, larowlan, alexpott, lauriii, Gábor Hojtsy, andrewmacpherson, catch, xjm, andypost, rahulrasgon, rabbitlair, mrconnerton, poojakural, boulaffasae, jerseycheese, shimpy, Indrajith KB, DuneBL, kiran.kadam911, komalkolekar, keboca, hawkeye.twolf, andrewozone, Maithri Shetty, alexdmccabe, sd9121, Sreenivas Bttv, katannshaw, mgifford, nod_, webchick, mtift, rainbreaw, Berdir, brianperry, thejimbirch, Dom., q0rban, nitesh624, hansa11, himanshu_sindhwani, kostyashupenko, shaktik, bnjmnm, sharma.amitt16, sonam.chaturvedi, steinmb, shaal, ressa, Ramya Balasubramanian, Sebacic, pradeepjha, tanmaykadam, thedrupalkid, vinitk, volkswagenchick, viappidu, vebrovski, Ujval Shah, Webbeh, Yuri, trebormc, msuthars, mrinalini9, bash247, chetanbharambe, ellenoise, anevins, andriyun, CocoM, JayKandari, ambuj_gupta, hussainweb, jhodgdon, Pooja Ganjage, ju.vanderw, jwitkowski79, MaxPah, Lokender Singh2, jponch, KarenS, KarinG, Lal_: Add new Olivero frontend theme to Drupal 9.1 core as beta; later make it stable and the default
2020-10-16 09:43:55 +00:00
|
|
|
e.preventDefault();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
window.addEventListener('resize', function () {
|
|
|
|
if (props.olivero.isDesktopNav()) {
|
|
|
|
toggleNav(props, false);
|
2020-10-26 14:31:28 +00:00
|
|
|
props.body.classList.remove('js-overlay-active');
|
|
|
|
props.body.classList.remove('js-fixed');
|
Issue #3111409 by mherchel, proeung, larowlan, alexpott, lauriii, Gábor Hojtsy, andrewmacpherson, catch, xjm, andypost, rahulrasgon, rabbitlair, mrconnerton, poojakural, boulaffasae, jerseycheese, shimpy, Indrajith KB, DuneBL, kiran.kadam911, komalkolekar, keboca, hawkeye.twolf, andrewozone, Maithri Shetty, alexdmccabe, sd9121, Sreenivas Bttv, katannshaw, mgifford, nod_, webchick, mtift, rainbreaw, Berdir, brianperry, thejimbirch, Dom., q0rban, nitesh624, hansa11, himanshu_sindhwani, kostyashupenko, shaktik, bnjmnm, sharma.amitt16, sonam.chaturvedi, steinmb, shaal, ressa, Ramya Balasubramanian, Sebacic, pradeepjha, tanmaykadam, thedrupalkid, vinitk, volkswagenchick, viappidu, vebrovski, Ujval Shah, Webbeh, Yuri, trebormc, msuthars, mrinalini9, bash247, chetanbharambe, ellenoise, anevins, andriyun, CocoM, JayKandari, ambuj_gupta, hussainweb, jhodgdon, Pooja Ganjage, ju.vanderw, jwitkowski79, MaxPah, Lokender Singh2, jponch, KarenS, KarinG, Lal_: Add new Olivero frontend theme to Drupal 9.1 core as beta; later make it stable and the default
2020-10-16 09:43:55 +00:00
|
|
|
}
|
2021-01-08 16:13:59 +00:00
|
|
|
|
|
|
|
Drupal.olivero.closeAllSubNav();
|
Issue #3111409 by mherchel, proeung, larowlan, alexpott, lauriii, Gábor Hojtsy, andrewmacpherson, catch, xjm, andypost, rahulrasgon, rabbitlair, mrconnerton, poojakural, boulaffasae, jerseycheese, shimpy, Indrajith KB, DuneBL, kiran.kadam911, komalkolekar, keboca, hawkeye.twolf, andrewozone, Maithri Shetty, alexdmccabe, sd9121, Sreenivas Bttv, katannshaw, mgifford, nod_, webchick, mtift, rainbreaw, Berdir, brianperry, thejimbirch, Dom., q0rban, nitesh624, hansa11, himanshu_sindhwani, kostyashupenko, shaktik, bnjmnm, sharma.amitt16, sonam.chaturvedi, steinmb, shaal, ressa, Ramya Balasubramanian, Sebacic, pradeepjha, tanmaykadam, thedrupalkid, vinitk, volkswagenchick, viappidu, vebrovski, Ujval Shah, Webbeh, Yuri, trebormc, msuthars, mrinalini9, bash247, chetanbharambe, ellenoise, anevins, andriyun, CocoM, JayKandari, ambuj_gupta, hussainweb, jhodgdon, Pooja Ganjage, ju.vanderw, jwitkowski79, MaxPah, Lokender Singh2, jponch, KarenS, KarinG, Lal_: Add new Olivero frontend theme to Drupal 9.1 core as beta; later make it stable and the default
2020-10-16 09:43:55 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
Drupal.behaviors.oliveroNavigation = {
|
2021-04-07 14:57:12 +00:00
|
|
|
attach: function attach(context) {
|
2021-04-09 11:34:27 +00:00
|
|
|
var headerId = 'header';
|
|
|
|
var header = once('olivero-navigation', "#".concat(headerId), context).shift();
|
Issue #3111409 by mherchel, proeung, larowlan, alexpott, lauriii, Gábor Hojtsy, andrewmacpherson, catch, xjm, andypost, rahulrasgon, rabbitlair, mrconnerton, poojakural, boulaffasae, jerseycheese, shimpy, Indrajith KB, DuneBL, kiran.kadam911, komalkolekar, keboca, hawkeye.twolf, andrewozone, Maithri Shetty, alexdmccabe, sd9121, Sreenivas Bttv, katannshaw, mgifford, nod_, webchick, mtift, rainbreaw, Berdir, brianperry, thejimbirch, Dom., q0rban, nitesh624, hansa11, himanshu_sindhwani, kostyashupenko, shaktik, bnjmnm, sharma.amitt16, sonam.chaturvedi, steinmb, shaal, ressa, Ramya Balasubramanian, Sebacic, pradeepjha, tanmaykadam, thedrupalkid, vinitk, volkswagenchick, viappidu, vebrovski, Ujval Shah, Webbeh, Yuri, trebormc, msuthars, mrinalini9, bash247, chetanbharambe, ellenoise, anevins, andriyun, CocoM, JayKandari, ambuj_gupta, hussainweb, jhodgdon, Pooja Ganjage, ju.vanderw, jwitkowski79, MaxPah, Lokender Singh2, jponch, KarenS, KarinG, Lal_: Add new Olivero frontend theme to Drupal 9.1 core as beta; later make it stable and the default
2020-10-16 09:43:55 +00:00
|
|
|
var navWrapperId = 'header-nav';
|
|
|
|
|
2021-04-09 11:34:27 +00:00
|
|
|
if (header) {
|
|
|
|
var navWrapper = header.querySelector('#header-nav');
|
Issue #3111409 by mherchel, proeung, larowlan, alexpott, lauriii, Gábor Hojtsy, andrewmacpherson, catch, xjm, andypost, rahulrasgon, rabbitlair, mrconnerton, poojakural, boulaffasae, jerseycheese, shimpy, Indrajith KB, DuneBL, kiran.kadam911, komalkolekar, keboca, hawkeye.twolf, andrewozone, Maithri Shetty, alexdmccabe, sd9121, Sreenivas Bttv, katannshaw, mgifford, nod_, webchick, mtift, rainbreaw, Berdir, brianperry, thejimbirch, Dom., q0rban, nitesh624, hansa11, himanshu_sindhwani, kostyashupenko, shaktik, bnjmnm, sharma.amitt16, sonam.chaturvedi, steinmb, shaal, ressa, Ramya Balasubramanian, Sebacic, pradeepjha, tanmaykadam, thedrupalkid, vinitk, volkswagenchick, viappidu, vebrovski, Ujval Shah, Webbeh, Yuri, trebormc, msuthars, mrinalini9, bash247, chetanbharambe, ellenoise, anevins, andriyun, CocoM, JayKandari, ambuj_gupta, hussainweb, jhodgdon, Pooja Ganjage, ju.vanderw, jwitkowski79, MaxPah, Lokender Singh2, jponch, KarenS, KarinG, Lal_: Add new Olivero frontend theme to Drupal 9.1 core as beta; later make it stable and the default
2020-10-16 09:43:55 +00:00
|
|
|
var olivero = Drupal.olivero;
|
|
|
|
var navButton = context.querySelector('.mobile-nav-button');
|
|
|
|
var body = context.querySelector('body');
|
|
|
|
var overlay = context.querySelector('.overlay');
|
|
|
|
init({
|
|
|
|
olivero: olivero,
|
2021-04-09 11:34:27 +00:00
|
|
|
header: header,
|
Issue #3111409 by mherchel, proeung, larowlan, alexpott, lauriii, Gábor Hojtsy, andrewmacpherson, catch, xjm, andypost, rahulrasgon, rabbitlair, mrconnerton, poojakural, boulaffasae, jerseycheese, shimpy, Indrajith KB, DuneBL, kiran.kadam911, komalkolekar, keboca, hawkeye.twolf, andrewozone, Maithri Shetty, alexdmccabe, sd9121, Sreenivas Bttv, katannshaw, mgifford, nod_, webchick, mtift, rainbreaw, Berdir, brianperry, thejimbirch, Dom., q0rban, nitesh624, hansa11, himanshu_sindhwani, kostyashupenko, shaktik, bnjmnm, sharma.amitt16, sonam.chaturvedi, steinmb, shaal, ressa, Ramya Balasubramanian, Sebacic, pradeepjha, tanmaykadam, thedrupalkid, vinitk, volkswagenchick, viappidu, vebrovski, Ujval Shah, Webbeh, Yuri, trebormc, msuthars, mrinalini9, bash247, chetanbharambe, ellenoise, anevins, andriyun, CocoM, JayKandari, ambuj_gupta, hussainweb, jhodgdon, Pooja Ganjage, ju.vanderw, jwitkowski79, MaxPah, Lokender Singh2, jponch, KarenS, KarinG, Lal_: Add new Olivero frontend theme to Drupal 9.1 core as beta; later make it stable and the default
2020-10-16 09:43:55 +00:00
|
|
|
navWrapperId: navWrapperId,
|
|
|
|
navWrapper: navWrapper,
|
|
|
|
navButton: navButton,
|
|
|
|
body: body,
|
2021-04-09 11:34:27 +00:00
|
|
|
overlay: overlay
|
Issue #3111409 by mherchel, proeung, larowlan, alexpott, lauriii, Gábor Hojtsy, andrewmacpherson, catch, xjm, andypost, rahulrasgon, rabbitlair, mrconnerton, poojakural, boulaffasae, jerseycheese, shimpy, Indrajith KB, DuneBL, kiran.kadam911, komalkolekar, keboca, hawkeye.twolf, andrewozone, Maithri Shetty, alexdmccabe, sd9121, Sreenivas Bttv, katannshaw, mgifford, nod_, webchick, mtift, rainbreaw, Berdir, brianperry, thejimbirch, Dom., q0rban, nitesh624, hansa11, himanshu_sindhwani, kostyashupenko, shaktik, bnjmnm, sharma.amitt16, sonam.chaturvedi, steinmb, shaal, ressa, Ramya Balasubramanian, Sebacic, pradeepjha, tanmaykadam, thedrupalkid, vinitk, volkswagenchick, viappidu, vebrovski, Ujval Shah, Webbeh, Yuri, trebormc, msuthars, mrinalini9, bash247, chetanbharambe, ellenoise, anevins, andriyun, CocoM, JayKandari, ambuj_gupta, hussainweb, jhodgdon, Pooja Ganjage, ju.vanderw, jwitkowski79, MaxPah, Lokender Singh2, jponch, KarenS, KarinG, Lal_: Add new Olivero frontend theme to Drupal 9.1 core as beta; later make it stable and the default
2020-10-16 09:43:55 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2021-04-09 11:34:27 +00:00
|
|
|
})(Drupal, once, tabbable);
|