   getInitialState: ->
     errors: []
 
+  componentDidMount: ->
+    @focus().cursorToEnd() if @props.autofocus
+
   componentDidUpdate: (prevProps, prevState) ->
     @props.onUpdated?(@state) unless _.isEqual(prevState, @state)
 

    onChange: React.PropTypes.func
    validate: React.PropTypes.func
    onUpdated: React.PropTypes.func

  getDefaultProps: ->
    validate: (inputValue) ->


  focus: ->
    ReactDOM.findDOMNode(@refs.input)?.focus()
    return @ # support chaining

  cursorToEnd: ->
    input = ReactDOM.findDOMNode(@refs.input)
    input.selectionStart = input.selectionEnd = input.value.length
    return @ # support chaining

  # The label has style "pointer-events: none" set.  Unfortunantly IE 10
  # doesn't support that and refuses to pass the click through the label into the input
