error handling

Better error handling for if focus is lost due to mouse. And some
changes in conditional onclick behavior for color button.