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

This commit is contained in:
G30 authored and GitHub committed 2026-06-29 03:37:09 -05:00
1 parent 8bc4ac2641
commit a8e5f0a54d
2 files changed
+13 -1

No files matched your search

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