Position dialogs relative to closest edge of screen.

This fixes a bug where the expansion of a QR dialog upon captcha
loading would push the response field off the bottom of the screen.