Close the submenus from depth outward (0 closes everything).
How many submenus deep el sits (0 inside the top-level surface).
ReadonlylayersThe open layers, outermost first.
Open trigger's submenu, closing any branch that isn't an ancestor of it.
Wire every item inside scope (recursively) that has a submenu: ARIA,
hidden, popover promotion, anchor names, and item normalization.
Idempotent, so it can run again after the DOM changes.
Controller returned by createSubmenus.