Skip to content
This repository has been archived by the owner on Jul 17, 2020. It is now read-only.

Commit

Permalink
added moveCursor, autofocus on edit now places cursor at end of input (
Browse files Browse the repository at this point in the history
  • Loading branch information
Thirdoptics authored and jspaine committed Oct 13, 2017
1 parent 400f27d commit 342f5bc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions client/modules/food/components/inventory/Category.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ class Category extends React.Component {
this.props.onItemRemove(this.props.id)
}

moveCursor = e => {
let storedValue = e.target.value
e.target.value = ''
e.target.value = storedValue
}

render = () => {
if (this.state.showEdit) {
return (
Expand All @@ -47,6 +53,7 @@ class Category extends React.Component {
value={this.state.editedName}
onChange={this.onChange}
onKeyDown={this.onEnterSubmitEdit}
onFocus={this.moveCursor}
required
autoFocus
/>
Expand Down

0 comments on commit 342f5bc

Please sign in to comment.