fix(ui): prevent space key from opening file/directory during rename in knowledge base (#25627)

This commit is contained in:
G30 2026-06-29 04:37:09 -04:00 committed by GitHub
parent 8bc4ac2641
commit a8e5f0a54d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 1 deletions

View file

@ -116,7 +116,10 @@
<button
class="relative flex items-center gap-1 rounded-xl p-2 text-left flex-1 justify-between"
type="button"
on:click={() => onNavigate(directory.id)}
on:click={() => {
if (editing) return;
onNavigate(directory.id);
}}
>
<div>
<div class="flex gap-2 items-center line-clamp-1">
@ -129,6 +132,10 @@
on:keydown={(e) => {
if (e.key === 'Enter') submitRename();
if (e.key === 'Escape') cancelRename();
if (e.key === ' ') e.stopPropagation();
}}
on:keyup={(e) => {
if (e.key === ' ') e.stopPropagation();
}}
on:blur={submitRename}
on:click={(e) => e.stopPropagation()}

View file

@ -108,6 +108,7 @@
class="relative flex items-center gap-1 rounded-xl p-2 text-left flex-1 justify-between"
type="button"
on:click={() => {
if (editingFileId) return;
onClick(file?.id ?? file?.tempId);
}}
on:dblclick={() => {
@ -125,6 +126,10 @@
on:keydown={(e) => {
if (e.key === 'Enter') submitRename();
if (e.key === 'Escape') cancelRename();
if (e.key === ' ') e.stopPropagation();
}}
on:keyup={(e) => {
if (e.key === ' ') e.stopPropagation();
}}
on:blur={submitRename}
on:click={(e) => e.stopPropagation()}