Fix regressions in popups handling (#1489932)