Fix #8182 by adding a check for left mouse click.

This should fix #8182 . @peterflynn can you double check?
We should test `event.which` at the very beginning of the mouseup handler (so we don't do any of this logic if the original click wasn't a left click).