Skip to content

Commit

Permalink
Fix for mobile menu hiding on scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
brettsmason committed Jun 11, 2019
1 parent c7aa9c9 commit 3170b40
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions resources/js/components/responsive-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default class ResponsiveMenu {
this.menuToggle.setAttribute('aria-expanded', 'false');
this._createSubmenuButtons();
this._createDropdownIcons();
this._setStates();
this._setInitialStates();
}

// Handle all events
Expand Down Expand Up @@ -178,14 +178,21 @@ export default class ResponsiveMenu {
}

// Set initial state of our menu depending on menu state
_setStates() {
_setInitialStates() {
if (this._isMobile()) {
this.menuToggle.setAttribute('aria-expanded', 'false');

[...this.submenus].forEach(submenu => {
submenu.removeAttribute('aria-haspopup');
});
} else {
this.menuToggle.removeAttribute('aria-expanded');
}
}

// Set state of our menu on screen size change.
_setStates() {
if (!this._isMobile()) {
this.menuToggle.setAttribute('aria-expanded', 'false');
this.menu.style.removeProperty('height');
}
Expand Down

0 comments on commit 3170b40

Please sign in to comment.