/** * Returns true if the element belongs to the current menu level of the * container, i.e. it is NOT inside a nested `role="menu"` sub-container. * * Uses `element.closest('[role="menu"]')` to determine the nearest menu * scope. If the nearest scope is the container's own `role="menu"` element, * the element belongs to this level. If it is a different (nested) menu, * the element belongs to a child level and should be excluded. * * Supports two container patterns: * * **1. Container has `role="menu"` directly** (preferred, used by avatar-group): * ``` *
*
* * ``` * Uses the simple check: `element.closest('[role="menu"]') === container` * * **2. Container is a wrapper without `role="menu"`** (used by dropdown-menu, * where `MenuGroup` owns `role="menu"` but does not accept a ref): * ``` *
← wrapper (no role="menu") * *
* * * ``` * Falls back to walking the DOM to check that the element's closest * `role="menu"` is the container's own menu (not doubly nested). * * Ideally all consumers should use pattern 1 (place the ref directly on the * `role="menu"` element). Pattern 2 exists because `@atlaskit/menu`'s * `MenuGroup` does not currently accept a ref. If `MenuGroup` gains ref * support in the future, dropdown-menu should switch to pattern 1 and the * fallback path can be removed. * * Used both as a `TFocusableFilter` (to scope getNextFocusable etc.) and as * a guard to prevent parent menu handlers from acting on events that * belong to a nested menu. */ export declare function isAtCurrentMenuLevel(element: Element, container: HTMLElement): boolean;