Fix for dropdown not closing when click events not propagating to document

Solves issue #228