Fix mishandling of events.

In some situations the "click" events were not stopped properly and the underlying actions failed
(specifically when using external JS libraries).
Merge pull request #297 from MartialGeek/master

Fix mishandling of events.