aboutsummaryrefslogtreecommitdiff
path: root/lib/elements/popup.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/elements/popup.ml')
-rwxr-xr-xlib/elements/popup.ml11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/elements/popup.ml b/lib/elements/popup.ml
index bf97559..28c414e 100755
--- a/lib/elements/popup.ml
+++ b/lib/elements/popup.ml
@@ -37,7 +37,6 @@ let create:
submit_btn
end;
-
let container = match form with
| None -> El.div
| Some _ -> El.form
@@ -73,6 +72,16 @@ let create:
let () = El.append_children (Document.body G.document)
[ el ] in
+ (* Add the focus to the first input element inside the form *)
+ let () = match form with
+ | Some (_, el) when El.is_el el ->
+ begin match (El.find_by_tag_name ~root:el (Jstr.v "input")) with
+ | [] -> ()
+ | hd::_ -> El.set_has_focus true hd
+ end
+ | _ -> ()
+ in
+
(* Event handler *)
let close_event = Evr.on_el
Ev.click