collision detection
Checking whether a floating element would run off the edge of the viewport and moving it if so.
In more detail
The lesson flips a panel from below its anchor to above when the bottom edge would overflow. Libraries also shift the panel sideways and resize it to fit.
Related terms
- Floating UI — A JavaScript library, and the general technique, for positioning a floating element such as a tooltip next to a reference element.
- viewport — The visible area of a web page in the browser window or device screen.
- bounding box — The smallest rectangle that encloses a shape or element, given by its position and size or by two opposite corners.
Taught in
- Floating Primitives: Popovers, Tooltips & Positioning — Design Systems & Component Engineering