     @props.tool_config ? @props.task.tool_config
 
   componentDidMount: ->
-    # @updatePosition()
+    # autofocus text input element (first time)
+    @refs[@props.ref || 'input0'].getDOMNode().focus() if @props.focus
 
     tool_config = @toolConfig()
     if tool_config.suggest == 'common'

    focus: true

  componentWillReceiveProps: ->
    console.log 'PROPS: ', @props
    @refs[@props.ref || 'input0'].getDOMNode().focus() if @props.focus

    {x,y} = @getPosition @props.subject.data
    @setState
      x: x
      y: y, => @forceUpdate() # updates component position on new subject

  componentWillUnmount: ->
    tool_config = @toolConfig()


    dx = e.pageX - @state.x #Click# - window.scrollX
    dy = e.pageY - @state.y #Click # + window.scrollY

    @setState
      x: dx
