Fixes #445 popup using click can sometimes open/close, caused by document clickaway event being preserved