Popup: replaced activeElement with targetElement for correct focus

Fixes gh-7533