fix putting focus on popup causing the popup to close under certain circumstances