fix: shouldn't scroll pressing a space during focus-typing
Massimo Melina committed
Sep 1, 2025 at 19:44 UTC
92867d75c55bdeecb153ec1ab62e7b6b03336d50
2 files changed
+5
-2
frontend/src/BrowseFiles.ts
+4
-1
@@ -115,8 +115,8 @@ function FilesList() {
115
if (ev.target !== document.body && !(ev.target && ref.current?.contains(ev.target as any))) return
116
if (isCtrlKey(ev as any) === 'Backspace' && location.pathname > '/')
117
return navigate(location.pathname + '..')
118
- const { key } = ev
118
if (ev.metaKey || ev.ctrlKey || ev.altKey) return
119
+ const { key } = ev
120
if (key === 'Tab' && focus) {
121
const go = ev.shiftKey ? -1 : 1
122
setFocusSkip(x => x + (go > 0 || x ? go : 0)) // we always try to go forward, and skip more, and if no enough matching items are found, we adjust "focusSkip" back
@@ -124,6 +124,9 @@ function FilesList() {
124
ev.preventDefault()
125
return
126
}
127
+ if (key === ' ' && !focus) return
128
+ if (key.length === 1 || key === 'Backspace')
129
+ ev.preventDefault()
130
setFocus(was => {
131
const will = key === 'Backspace' ? was.slice(0, -1)
132
: key === 'Escape' ? ''
src/serveFile.ts
+1
-1
@@ -7,7 +7,7 @@ import { HTTP_BAD_REQUEST, HTTP_FORBIDDEN, HTTP_METHOD_NOT_ALLOWED, HTTP_NO_CONT
7
import { getNodeName, VfsNode } from './vfs'
8
import mimetypes from 'mime-types'
9
import { defineConfig } from './config'
10
-import { CFG, Dict, makeMatcher, matches, normalizeHost, try_, with_ } from './misc'
10
+import { CFG, Dict, makeMatcher, matches, try_, with_ } from './misc'
11
import _ from 'lodash'
12
import { basename } from 'path'
13
import { promisify } from 'util'