prevent scroll on menu toggle
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
if (menuToggleLabel) menuToggleLabel.textContent = 'Close';
|
if (menuToggleLabel) menuToggleLabel.textContent = 'Close';
|
||||||
mobileMenu.setAttribute('aria-hidden', 'false');
|
mobileMenu.setAttribute('aria-hidden', 'false');
|
||||||
siteContent.setAttribute('inert', '');
|
siteContent.setAttribute('inert', '');
|
||||||
menuToggle.focus();
|
menuToggle.focus({ preventScroll: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeMenu() {
|
function closeMenu() {
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
if (menuToggleLabel) menuToggleLabel.textContent = 'Menu';
|
if (menuToggleLabel) menuToggleLabel.textContent = 'Menu';
|
||||||
mobileMenu.setAttribute('aria-hidden', 'true');
|
mobileMenu.setAttribute('aria-hidden', 'true');
|
||||||
siteContent.removeAttribute('inert');
|
siteContent.removeAttribute('inert');
|
||||||
menuToggle.focus();
|
menuToggle.focus({ preventScroll: true });
|
||||||
|
|
||||||
window.setTimeout(() => {
|
window.setTimeout(() => {
|
||||||
if (!body.classList.contains('menu-open')) {
|
if (!body.classList.contains('menu-open')) {
|
||||||
|
|||||||
Reference in New Issue
Block a user