From 5061e785c4a61143837437e08c8280e4768aa4dc Mon Sep 17 00:00:00 2001 From: Adrian Gruntkowski Date: Fri, 6 Dec 2024 13:24:31 +0100 Subject: [PATCH] Make it easier to focus note form input --- priv/static/js/components.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/priv/static/js/components.js b/priv/static/js/components.js index 0fb92e5..cdd0b0d 100644 --- a/priv/static/js/components.js +++ b/priv/static/js/components.js @@ -456,6 +456,20 @@ class NoteForm extends HTMLElement { this.addButton = this.querySelector(".add"); this.saveButton = this.querySelector(".save"); + this.addEventListener("click", (e) => { + if ( + !( + e.target instanceof HTMLInputElement || + e.target instanceof HTMLButtonElement || + e.target instanceof HTMLTextAreaElement + ) + ) { + this.content.querySelector("textarea")?.focus(); + } + + return true; + }); + this.tasklistModeButton.addEventListener("click", (e) => { e.preventDefault(); this.note.type = "tasklist";