MCPcopy
hub / github.com/ionic-team/ionic-framework / Menu

Class Menu

core/src/components/menu/menu.tsx:38–868  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36 shadow: true,
37})
38export class Menu implements ComponentInterface, MenuI {
39 private animation?: Animation;
40 private lastOnEnd = 0;
41 private gesture?: Gesture;
42 private blocker = GESTURE_CONTROLLER.createBlocker({ disableScroll: true });
43 private didLoad = false;
44
45 /**
46 * Flag used to determine if an open/close
47 * operation was cancelled. For example, if
48 * an app calls "menu.open" then disables the menu
49 * part way through the animation, then this would
50 * be considered a cancelled operation.
51 */
52 private operationCancelled = false;
53
54 isAnimating = false;
55 width!: number;
56 _isOpen = false;
57
58 backdropEl?: HTMLIonBackdropElement;
59 menuInnerEl?: HTMLElement;
60 contentEl?: HTMLElement;
61 lastFocus?: HTMLElement;
62
63 private inheritedAttributes: Attributes = {};
64
65 private handleFocus = (ev: FocusEvent) => {
66 /**
67 * Overlays have their own focus trapping listener
68 * so we do not want the two listeners to conflict
69 * with each other. If the top-most overlay that is
70 * open does not contain this ion-menu, then ion-menu's
71 * focus trapping should not run.
72 */
73 const lastOverlay = getPresentedOverlay(document);
74 if (lastOverlay && !lastOverlay.contains(this.el)) {
75 return;
76 }
77
78 this.trapKeyboardFocus(ev, document);
79 };
80
81 @Element() el!: HTMLIonMenuElement;
82
83 /**
84 * If true, then the menu should be
85 * visible within a split pane.
86 * If false, then the menu is hidden.
87 * However, the menu-button/menu-toggle
88 * components can be used to open the
89 * menu.
90 */
91 @State() isPaneVisible = false;
92 @State() isEndSide = false;
93
94 /**
95 * The `id` of the main content. When using

Callers

nothing calls this directly

Calls 3

trapKeyboardFocusMethod · 0.95
getPresentedOverlayFunction · 0.90
createBlockerMethod · 0.80

Tested by

no test coverage detected