Skip to content

Commit edace18

Browse files
committed
Fix focus lost after rename cancellation
Pane focus wasn't restored when inline rename was canceled due to permission errors, noop results, conflict resolution failures, or external file removal. Keyboard navigation broke because focus stayed on <body> after the editor unmounted.
1 parent 7bb371a commit edace18

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

apps/desktop/src/lib/file-explorer/pane/FilePane.svelte

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@
343343
if (errorMsg && rename.active && rename.target?.path === entry.path) {
344344
rename.cancel()
345345
renameNotification = { message: errorMsg, style: 'error' }
346+
onRequestFocus?.()
346347
}
347348
})
348349
}
@@ -403,6 +404,7 @@
403404
switch (result.type) {
404405
case 'noop':
405406
rename.cancel()
407+
onRequestFocus?.()
406408
break
407409
case 'error':
408410
rename.triggerShake()
@@ -476,6 +478,7 @@
476478
477479
if (!target || !trimmedName) {
478480
rename.cancel()
481+
onRequestFocus?.()
479482
return
480483
}
481484
@@ -491,6 +494,7 @@
491494
const msg = e instanceof Error ? e.message : String(e)
492495
renameNotification = { message: msg, style: 'error' }
493496
rename.cancel()
497+
onRequestFocus?.()
494498
})
495499
break
496500
}
@@ -1475,6 +1479,7 @@
14751479
const wasRemoved = diff.changes.some((c) => c.type === 'remove' && c.entry.name === targetName)
14761480
if (wasRemoved) {
14771481
rename.cancel()
1482+
onRequestFocus?.()
14781483
}
14791484
}
14801485

0 commit comments

Comments
 (0)