aboutsummaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-08-11 20:05:56 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-08-11 20:05:56 +0200
commitaa18e57dfdf2bd0f626d7101ab712e6a0ff6dbf3 (patch)
treec82eea859f7aac03f0e8daa5cbec7ff461411bf6 /static
parentKeep summary when editing existing elements. (diff)
downloadcalp-aa18e57dfdf2bd0f626d7101ab712e6a0ff6dbf3.tar.gz
calp-aa18e57dfdf2bd0f626d7101ab712e6a0ff6dbf3.tar.xz
Focus summary when editing existing.
Diffstat (limited to 'static')
-rw-r--r--static/script.js11
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();
});
}