From 6379772305c23cce4efed9077ab8f219fe1f10f3 Mon Sep 17 00:00:00 2001 From: r-zakarya <82443831+r-zakarya@users.noreply.github.com> Date: Thu, 9 Jul 2026 18:37:11 +0100 Subject: [PATCH] fix(slideover): don't grab + select the title after Save MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit soSave re-opens the slideover on the just-saved entry to keep it visible, but openSlideOver's edit-mode path focuses + selects the Title input — so every Save jarringly jumped focus to the title with its text highlighted. Added an opts.noFocus flag to openSlideOver and pass it from the post-save re-open; normal opens (click / Enter from j/k nav) still auto-focus the title. Co-Authored-By: Claude Opus 4.8 --- js/app.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/js/app.js b/js/app.js index 840618c..bf23858 100644 --- a/js/app.js +++ b/js/app.js @@ -3996,11 +3996,13 @@ async function openSlideOver(id, opts) { : document.getElementById('soSite'); if (f) f.focus(); }, 50); - } else { + } else if (!opts.noFocus) { // Edit mode: focus the Title input so the user can start editing // immediately (especially when opened via Enter from j/k nav). // Defer so the slideover transition finishes first — otherwise // the browser may steal focus back during the animation. + // Skipped on the post-save re-open (opts.noFocus) — grabbing + + // selecting the title right after Save is jarring. setTimeout(() => { const f = document.getElementById('soTitle'); if (f) { f.focus(); f.select(); } @@ -4844,7 +4846,9 @@ async function soSave() { // leave soState at id=null, causing a second Save to POST again // and create a duplicate. soState = null; - if (updated) openSlideOver(updated.id); + // noFocus: keep the slideover open on the saved entry WITHOUT grabbing + // + selecting the title (jarring right after Save). + if (updated) openSlideOver(updated.id, { noFocus: true }); else closeSlideOver(); render(); if (isNew && targetId) {