From 7507a4324f1122f82db4957382dd0b5b86e4b702 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Fri, 4 Sep 2026 17:35:38 +0200 Subject: [PATCH] Preselect new poll option's type from the option above it When adding a new option, defaulting its type to whatever the current last option uses saves a reselect when adding several options of the same kind in a row. Purely positional (the option immediately above), not tied to whichever option was most recently edited. Co-Authored-By: Claude Sonnet 5 --- src/struudel/static/js/polls-edit.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/struudel/static/js/polls-edit.js b/src/struudel/static/js/polls-edit.js index d990a58..b4112a7 100644 --- a/src/struudel/static/js/polls-edit.js +++ b/src/struudel/static/js/polls-edit.js @@ -64,7 +64,8 @@ function optionsEditor(initial) { }); }, add() { - this.options.push(mk()); + const above = this.options[this.options.length - 1]; + this.options.push(mk(above ? { type: above.type } : null)); }, remove(i) { this.options.splice(i, 1);