diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-08-11 20:05:56 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-08-11 20:05:56 +0200 |
commit | aa18e57dfdf2bd0f626d7101ab712e6a0ff6dbf3 (patch) | |
tree | c82eea859f7aac03f0e8daa5cbec7ff461411bf6 /static | |
parent | Keep summary when editing existing elements. (diff) | |
download | calp-aa18e57dfdf2bd0f626d7101ab712e6a0ff6dbf3.tar.gz calp-aa18e57dfdf2bd0f626d7101ab712e6a0ff6dbf3.tar.xz |
Focus summary when editing existing.
Diffstat (limited to '')
-rw-r--r-- | static/script.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/static/script.js b/static/script.js index 7f9291d7..5b6f561a 100644 --- a/static/script.js +++ b/static/script.js @@ -475,6 +475,10 @@ function place_in_edit_mode (event) { /* ---------------------------------------- */ + /* TODO add elements if the arent't already there + * Almost all should be direct children of '.event-body'. + * Biggest problem is generated fields relative order. + */ let descs = popup.getElementsByClassName("description"); if (descs.length === 1) { let description = descs[0]; @@ -515,6 +519,11 @@ function place_in_edit_mode (event) { article.replaceWith(wrappingForm); wrappingForm.appendChild(article); + /* this is for existing events. + * Newly created events aren't in the DOM tree yet, and can + * therefore not yet be focused */ + input.focus(); + } window.onload = function () { @@ -558,7 +567,7 @@ window.onload = function () { let popupElement = document.getElementById("popup" + event.id); open_popup(popupElement); - popupElement.querySelector("input[name='summary']").focus(); + popupElement.querySelector("input[name='summary']").focus(); }); } |