From bb6450bda24ae993152f20b645250267ee2997ce Mon Sep 17 00:00:00 2001 From: Lephe Date: Sat, 31 Oct 2020 22:15:03 +0100 Subject: [PATCH] editor: don't autofocus by default Autofocus prompts the browser to scroll to the editor when the page loads, which makes little to no sense on topic pages where the important information is at the top. --- app/templates/forum/edit_comment.html | 2 +- app/templates/widgets/editor.html | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/templates/forum/edit_comment.html b/app/templates/forum/edit_comment.html index 18ba28a..de4d7af 100644 --- a/app/templates/forum/edit_comment.html +++ b/app/templates/forum/edit_comment.html @@ -31,7 +31,7 @@ {% endfor %} {% endif %} - {{ widget_editor.text_editor(form.message, label=False) }} + {{ widget_editor.text_editor(form.message, label=False, autofocus=True) }}
{{ form.submit(class_='bg-ok') }}
diff --git a/app/templates/widgets/editor.html b/app/templates/widgets/editor.html index c4dc0a4..5ac3706 100644 --- a/app/templates/widgets/editor.html +++ b/app/templates/widgets/editor.html @@ -1,11 +1,11 @@ -{% macro text_editor(field, label=True) %} +{% macro text_editor(field, label=True, autofocus=false) %} {{ field.label if label }} {{ field() }}