popup: closes when user clicks button or some inputs via spacebar (close #1134)

// cc @narqo @dfilatov