Ver Fonte

fix: focusout issue on todomvc

Jonathan Kelley há 3 anos atrás
pai
commit
8d56552908
1 ficheiros alterados com 1 adições e 1 exclusões
  1. 1 1
      examples/todomvc.rs

+ 1 - 1
examples/todomvc.rs

@@ -129,7 +129,6 @@ pub fn todo_entry<'a>(cx: Scope<'a, TodoEntryProps<'a>>) -> Element {
             label {
             label {
                 r#for: "cbg-{todo.id}",
                 r#for: "cbg-{todo.id}",
                 onclick: move |_| set_is_editing(true),
                 onclick: move |_| set_is_editing(true),
-                onfocusout: move |_| set_is_editing(false),
                 "{todo.contents}"
                 "{todo.contents}"
             }
             }
         }
         }
@@ -139,6 +138,7 @@ pub fn todo_entry<'a>(cx: Scope<'a, TodoEntryProps<'a>>) -> Element {
                 value: "{todo.contents}",
                 value: "{todo.contents}",
                 oninput: move |evt| cx.props.set_todos.make_mut()[&cx.props.id].contents = evt.value.clone(),
                 oninput: move |evt| cx.props.set_todos.make_mut()[&cx.props.id].contents = evt.value.clone(),
                 autofocus: "true",
                 autofocus: "true",
+                onfocusout: move |_| set_is_editing(false),
                 onkeydown: move |evt| {
                 onkeydown: move |evt| {
                     match evt.key.as_str() {
                     match evt.key.as_str() {
                         "Enter" | "Escape" | "Tab" => set_is_editing(false),
                         "Enter" | "Escape" | "Tab" => set_is_editing(false),