You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Web UI: DRY the modals — adopt useModalA11y in 5 hand-rolled modals; route remaining raw fetches through the API client #146
1. Five modals hand-roll the focus trap/Escape instead of the shared hook.LoadConfigModal.tsx:76-98, DirectoryPickerModal.tsx:84-106, LogViewerModal.tsx:133-155, FilePropertiesModal.tsx:92-136, SingleMatchPromptModal.tsx:20-35 each reimplement the Tab trap + Escape + focus restore that utils/useModalA11y.ts already provides (used by ConfirmDialog, TimerModal, SaveAsDialog, ShortcutsModal, BarcodeModal, CameraBarcodeModal, ConfigEditorModal). The drift is real: SingleMatchPromptModal has no Tab trap at all, and the hand-rolled variants lack the hook's "focus drifted out — pull it back" behavior. Two more inconsistencies ride along: ShortcutsModal (:43) and TimerModal (:58) lack the backdrop onClick={onClose} that every other dialog has.
2. Raw fetches bypass the API client and discard error detail.
DirectoryPickerModal.tsx:59-74 does a bare fetch("/api/fs/browse?…") with a generic "Failed to browse directory" message, plus local BrowseEntry/BrowseResult interfaces duplicating api/typesBrowseResult (which SaveAsDialog imports). client.ts already exposes browseDirectory() (client.ts:320).
App.tsx:940-945 (confirmDeleteFile) is the lone raw action call: fetch("/api/actions/delete") with a generic "Failed to delete file" — the server's reason (permission denied vs not found) is swallowed. client.ts has no deleteFile export.
Suggested fix
Adopt useModalA11y in all five (SingleMatchPromptModal keeps its Enter/Escape window listener layered on top); add backdrop-click to Shortcuts/Timer for consistency.
Call browseDirectory(path) + import the shared type; add deleteFile(filePath) to client.ts following the existing apiError pattern and use it in confirmDeleteFile.
Activity