fix #1306 - focus wrongly assigned when a popup is destroyed

a timeout was inserted in order to check if the focus has to be moved by the user click or has to be forced (in case no focusable element is clicked)

closes #1306