I changed the logic because I realized that click event was not triggering the proper action when the event was hidden. I should probably have filled another bug for it, but since it was an easy fix (and related) I decided to do in the same pull request. - If you want to I can file a new bug and split into 2 pull requests.