Attach widget click event to document

Task #799