Skip to content

Commit

Permalink
Merge pull request #368 from wttech/todo-list-enter-key-support-while…
Browse files Browse the repository at this point in the history
…-adding-items

#356 - Widget | ToDo list - enter key support while adding items
  • Loading branch information
GrzegorzBednarski authored Apr 30, 2021
2 parents c077b13 + 7379f72 commit a700e7e
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ const ToDoListInput = ({ value, values, onChange }) => {
resetInput();
};

const onInputKeyDown = event => {
if (event.key === 'Enter') {
event.preventDefault();
onSaveClick();
}
};

const onClearClick = () => {
if (!selectedItems) return;

Expand Down Expand Up @@ -118,6 +125,7 @@ const ToDoListInput = ({ value, values, onChange }) => {
placeholder="Item Title"
margin="normal"
onChange={handleChangeValItemText}
onKeyDown={onInputKeyDown}
value={formValueItemText}
/>
<StyledFabGroup>
Expand Down

0 comments on commit a700e7e

Please sign in to comment.