Use isHidden instead of isKeyWindow because isKeyWindow is somehow not correctly updated