Nested submenu machinery shared by the dropdown and menubar enhancers. Each
submenu is a native popover="manual" (where available) anchored to its
trigger with CSS anchor positioning (JS fallback otherwise). The controller
tracks the open branch as a stack of layers so keyboard handlers can open
one level deeper or close one level back, and so a click outside or a
closing parent can collapse the whole branch at once.
Nested submenu machinery shared by the dropdown and menubar enhancers. Each submenu is a native
popover="manual"(where available) anchored to its trigger with CSS anchor positioning (JS fallback otherwise). The controller tracks the open branch as a stack of layers so keyboard handlers can open one level deeper or close one level back, and so a click outside or a closing parent can collapse the whole branch at once.