An overlay might overflow the viewport – for example, a dropdown near the bottom of the screen will extend below the visible area, causing a bad user experience. You need to detect how many pixels overflow each edge.
The `detectCollision(top, left, width, height)` function returns an object with `top`, `bottom`, `left`, `right` properties containing the overflow amount (in pixels) for each edge. `hasCollision()` tells you if any overflow exists.
Tooltip, Popover, Dropdown, ContextMenu, Select, Combobox