Findings No. 28
Viewport-flipped popovers must re-clamp on close transitions too
Menus flipped upward by viewport clamping stayed flipped after their submenu collapsed, because re-clamping ran only on open. Clamping is a function of current geometry, not a one-time placement.
A popover menu that flips upward when it opens near the viewport's bottom edge has to answer a second question: what happens when its contents change while open? Woof Editor's menus re-clamped their position only when a submenu opened. When the submenu collapsed again, the now-shorter menu stayed flipped in its upward position, hovering strangely far from its anchor.
The fix is symmetry: re-clamp on both transitions, open and close, so the menu's position always reflects its current size.
The general rule: viewport clamping is a function of current geometry, not a one-time placement decision. Any event that changes a floating element's size (submenu toggles, async content, validation messages) is a re-clamp trigger, in both directions.
Receipt: woof-editor CHANGELOG 0.2.0 (Fixed: ElementMenu / ContextMenu / SelectionMenu re-clamp on both transitions).