This fixes the issue of clicking back in to the box not causing it to expand. Tabbing in causes a key-up event, but clicking only causes a focus event.

Also, the focus event occurs to happen BEFORE the state of the element has changed to focused, so we use a boolean to tell the handler to assume the element is focused.