Use 'mousedown' to detect a click outside the editable area, instead of 'click'.

'click' is also triggered when dragging out of the editable area ('mousedown' in it, 'mouseup' outside), which is not the desired behavior.