Fix #532, correct behavior of click handlers