Fix file picker keyboard event handling and loading state

This commit is contained in:
Shantur Rathore
2025-10-24 00:52:17 +01:00
parent b6dc4ba249
commit f291649f74

View File

@@ -182,14 +182,17 @@ const FilePicker: Component<FilePickerProps> = (props) => {
if (e.key === "ArrowDown") {
e.preventDefault()
e.stopPropagation()
handleNavigateDown()
props.onNavigate("down")
} else if (e.key === "ArrowUp") {
e.preventDefault()
e.stopPropagation()
handleNavigateUp()
props.onNavigate("up")
} else if (e.key === "Enter") {
e.preventDefault()
e.stopPropagation()
if (fileList[selectedIndex()]) {
handleSelect(fileList[selectedIndex()].path)
}
@@ -209,7 +212,7 @@ const FilePicker: Component<FilePickerProps> = (props) => {
>
<div class="max-h-96 overflow-y-auto">
<Show
when={!loading()}
when={!loading() && isInitialized()}
fallback={
<div class="p-4 text-center text-sm text-gray-500">
<div class="inline-block h-4 w-4 animate-spin rounded-full border-2 border-gray-300 border-t-blue-600"></div>