popup: doesn't invalidate zIndex when anchor set while popup is hidden (close #1214)

close #1214
Can you write more informative message in case the assertion fail?