A popover or tooltip that touches the viewport edge feels cramped and may obscure scrollbars. Users expect a small gap (padding) between the floating element and the screen edge.
constrainToViewport() takes a padding object (top/right/bottom/left) and adjusts the element's
position so it stays within the viewport with the specified gap.
Tooltip, Popover, Dropdown, ContextMenu, Select.