fix(slideover): don't grab + select the title after Save
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 <noreply@anthropic.com>
This commit is contained in:
@@ -3996,11 +3996,13 @@ async function openSlideOver(id, opts) {
|
|||||||
: document.getElementById('soSite');
|
: document.getElementById('soSite');
|
||||||
if (f) f.focus();
|
if (f) f.focus();
|
||||||
}, 50);
|
}, 50);
|
||||||
} else {
|
} else if (!opts.noFocus) {
|
||||||
// Edit mode: focus the Title input so the user can start editing
|
// Edit mode: focus the Title input so the user can start editing
|
||||||
// immediately (especially when opened via Enter from j/k nav).
|
// immediately (especially when opened via Enter from j/k nav).
|
||||||
// Defer so the slideover transition finishes first — otherwise
|
// Defer so the slideover transition finishes first — otherwise
|
||||||
// the browser may steal focus back during the animation.
|
// 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(() => {
|
setTimeout(() => {
|
||||||
const f = document.getElementById('soTitle');
|
const f = document.getElementById('soTitle');
|
||||||
if (f) { f.focus(); f.select(); }
|
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
|
// leave soState at id=null, causing a second Save to POST again
|
||||||
// and create a duplicate.
|
// and create a duplicate.
|
||||||
soState = null;
|
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();
|
else closeSlideOver();
|
||||||
render();
|
render();
|
||||||
if (isNew && targetId) {
|
if (isNew && targetId) {
|
||||||
|
|||||||
Reference in New Issue
Block a user