Tooltips
The viewport is used to check if the tooltip goes out of bounds. If so, it is flipped or shifted accordingly. If the source element leaves the viewport, the tooltip is hidden.
Dropdowns
Popovers
Dismissible popoverScope an anchor to a given element so that its used for bounds instead of the whole viewport. See how the placement change to keep the anchored element inside the frame.
Multiple scrolling elements don't matter. If the element leaves the viewport, the anchored element is hidden.