todo_widget: Fix cursor focus in todo lists.

Previously, when adding a task to a /todo list, after pressing "Add
task", the cursor would move to the "Description" field, which is
not the desired behavior. This commit fixes this issue by ensuring
that the cursor moves to the "New task" field after a task is created.

The core bug was introduced in
68dcdcd28e, which added the incorrect
.focus().

Also tighten the selectors while we're at it.

Fixes #25064.
This commit is contained in:
Akarsh Jain
2023-04-21 23:39:00 +05:30
committed by Tim Abbott
parent 9e4b5b2bed
commit b154722dec

View File

@@ -179,8 +179,8 @@ export function activate(opts) {
return;
}
$elem.find(".add-task").val("").trigger("focus");
$elem.find(".add-desc").val("").trigger("focus");
$elem.find("input.add-task").val("").trigger("focus");
$elem.find("input.add-desc").val("");
const task_exists = task_data.name_in_use(task);
if (task_exists) {