Build one geometry engine and several semantic adapters. Tooltip, menu, listbox popup, teaching bubble, and non-modal dialog can share anchor measurement and collision fallback, but they must not share one vague focus and dismissal behavior.
Floating UI looks like a box next to another box. In practice, it crosses layout, scrolling, portals, writing modes, viewport changes, keyboard input, pointer intent, and accessibility semantics.
The platform stays understandable when it separates what a surface means from where it fits.
Start with semantic families
The trigger chooses a semantic adapter before the geometry engine runs:
- tooltip: descriptive, non-interactive, focus remains on the trigger;
- menu: composite action list with menu keyboard behavior;
- listbox popup: option selection owned by a combobox or button;
- popover or non-modal dialog: interactive content with a deliberate focus contract;
- teaching bubble: product guidance with dismissal and persistence policy.
Two surfaces can use the same bottom-start placement and still require completely different roles, keyboard behavior, and announcements.
The public interview prompt
Design a reusable tooltip, popover, and floating-layer platform. Explain:
- semantic adapters, controlled state, trigger ownership, and nested layer trees;
- anchor measurement, clipping, collision, flip, shift, size, arrow, and writing direction;
- portals, browser top layer, CSS anchor positioning, scroll and resize updates;
- focus, hover intent, Escape, outside interaction, restoration, and touch;
- loading, detached anchors, route changes, zoom, mobile, and reduced motion;
- security, performance, observability, testing, rollout, and evolution.
Assume modern browsers with a documented fallback matrix. Version one supports element anchors in one document, not arbitrary canvas coordinates, cross-frame anchors, or collaborative cursors.
What the premium solution covers
The complete solution defines semantic and geometry contracts, anchor and clipping measurements, ordered fallback scoring, browser top-layer and portal adapters, CSS anchor-positioning adoption, branch-aware dismissal, focus policies, tooltip timing, touch and mobile behavior, detached anchors, performance budgets, privacy, deterministic geometry tests, rollout gates, and an interview scoring rubric.
Original media shows a surface colliding, flipping, and following its anchor, while a separate diagram maps semantic families to focus and dismissal behavior. A deterministic lab lets you move an anchor and switch surface semantics without conflating the two concerns.