Skip to content

Commit

Permalink
fix: mgt-planner task deletion on keyboard interaction (#3214)
Browse files Browse the repository at this point in the history
* fix task deletion on keyboard interaction

* correct comment
  • Loading branch information
Mnickii authored Jun 13, 2024
1 parent 49ada05 commit 0ef8dd7
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -592,12 +592,17 @@ export class MgtPlanner extends MgtTemplatedTaskComponent {
await this._task.run();
}

private async removeTask(task: ITask) {
private async removeTask(task: ITask, e: Event) {
const ts = this.getTaskSource();
if (!ts) {
return;
}

// check if e is a Keyboard Event
if (e instanceof KeyboardEvent) {
if (e.key !== 'Enter') {
return;
}
}
this._hiddenTasks = [...this._hiddenTasks, task.id];
await ts.removeTask(task);
this.fireCustomEvent('taskRemoved', task);
Expand Down Expand Up @@ -1004,7 +1009,7 @@ export class MgtPlanner extends MgtTemplatedTaskComponent {
<mgt-dot-options
class="dot-options"
.options="${{
[this.strings.removeTaskSubtitle]: () => this.removeTask(task)
[this.strings.removeTaskSubtitle]: (e: Event) => this.removeTask(task, e)
}}"
></mgt-dot-options>`;

Expand Down

0 comments on commit 0ef8dd7

Please sign in to comment.