Popup: Clean up focus restriction handling. Fixes #5519.