-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(menu-button): hide menu button when auto hide or split pane (#18702)
- updates menu-button to use the host element - moves menu-toggle logic to a utils file for menu button to share - removes the dependency on menu-toggle - adds an e2e test for an auto-hidden menu button fixes #18666
- Loading branch information
1 parent
876ab41
commit 24840d4
Showing
8 changed files
with
96 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
// Get the menu controller element | ||
export const getMenuController = (doc: Document): Promise<HTMLIonMenuControllerElement | undefined> => { | ||
const menuControllerElement = doc.querySelector('ion-menu-controller'); | ||
if (!menuControllerElement) { | ||
return Promise.resolve(undefined); | ||
} | ||
return menuControllerElement.componentOnReady(); | ||
}; | ||
|
||
// Given a menu, toggle it | ||
export const toggleMenu = async (menu: string | undefined) => { | ||
const menuCtrl = await getMenuController(document); | ||
if (menuCtrl) { | ||
const menuEl = await menuCtrl.get(menu); | ||
if (menuEl) { | ||
menuCtrl.toggle(menu); | ||
} | ||
} | ||
}; | ||
|
||
// Given a menu, return whether or not the menu toggle should be visible | ||
export const updateVisibility = async (menu: string | undefined) => { | ||
const menuCtrl = await getMenuController(document); | ||
if (menuCtrl) { | ||
const menuEl = await menuCtrl.get(menu); | ||
if (menuEl && await menuEl.isActive()) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters