Skip to content

Commit

Permalink
fix: focus on the input when you cancel adding a todo (#3005)
Browse files Browse the repository at this point in the history
  • Loading branch information
musale authored Feb 2, 2024
1 parent b254e49 commit 14bb9c1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/mgt-components/src/components/mgt-todo/mgt-todo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,15 @@ export class MgtTodo extends MgtTasksBase {
this._newTaskName = '';
this._changedTaskName = '';
this._isChangedDueDate = false;
this.focusOnTaskInput();
};

protected focusOnTaskInput = (): void => {
const taskInputWrapper = this.renderRoot.querySelector<HTMLInputElement>('#new-task-name-input');
const input = taskInputWrapper?.shadowRoot.querySelector<HTMLInputElement>('input');
if (input) {
input.focus();
}
};

/**
Expand Down

0 comments on commit 14bb9c1

Please sign in to comment.