fix: focusout issue on todomvc

This commit is contained in:
Jonathan Kelley committed 2022-02-23 18:17:28 -05:00
1 parent 03feaa446a
commit 8d56552908
1 file changed
+1 -1
+1 -1
View File
@@ -129,7 +129,6 @@ pub fn todo_entry<'a>(cx: Scope<'a, TodoEntryProps<'a>>) -> Element {
label {
r#for: "cbg-{todo.id}",
onclick: move |_| set_is_editing(true),
onfocusout: move |_| set_is_editing(false),
"{todo.contents}"
}
}
@@ -139,6 +138,7 @@ pub fn todo_entry<'a>(cx: Scope<'a, TodoEntryProps<'a>>) -> Element {
value: "{todo.contents}",
oninput: move |evt| cx.props.set_todos.make_mut()[&cx.props.id].contents = evt.value.clone(),
autofocus: "true",
onfocusout: move |_| set_is_editing(false),
onkeydown: move |evt| {
match evt.key.as_str() {
"Enter" | "Escape" | "Tab" => set_is_editing(false),