Clamp the popup position so it stays inside the viewport.
Popup element references created by createPopupDom.
Clamp the popup position so it stays inside the viewport.