Skip to main content
Lightning Jar - Web Studio Lightning Jar Wordmark

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.

Woof Editor Browser Platform verified Floating menus with viewport clamping

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).

Ask Eljay

Ask about the studio's work, research, packages, or writing. A few starters:

Answers come from this site's own content and link their sources. For anything that matters, email hello@lightningjar.com.