Web UI: DRY the modals — adopt useModalA11y in 5 hand-rolled modals; route remaining raw fetches through the API client
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 58/100
- Issue 类型
- 重构
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- python, react, typescript
调研方向
Read utils/useModalA11y.ts, then compare its use in ConfirmDialog and the five named modal files: LoadConfigModal.tsx, DirectoryPickerModal.tsx, LogViewerModal.tsx, FilePropertiesModal.tsx, and SingleMatchPromptModal.tsx. Also inspect client.ts around browseDirectory() and apiError, plus App.tsx around confirmDeleteFile. Done means the five modals use the shared hook, ShortcutsModal and TimerModal close on backdrop clicks, and both directory browsing and file deletion use the API client while preserving useful error details.
由索引模型根据 Issue 内容生成。
描述
Problem
Two consistency gaps across the component layer:
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-74does a barefetch("/api/fs/browse?…")with a generic "Failed to browse directory" message, plus localBrowseEntry/BrowseResultinterfaces duplicatingapi/typesBrowseResult(which SaveAsDialog imports).client.tsalready exposesbrowseDirectory()(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.tshas nodeleteFileexport.
Suggested fix
- Adopt
useModalA11yin 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; adddeleteFile(filePath)toclient.tsfollowing the existingapiErrorpattern and use it inconfirmDeleteFile.
- 主要语言
- Python
- 星标
- 1
- 派生
- 1
- 平均合并
- 4 小时 46 分钟
- 30 天内合并 PR
- 55
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
falbany/ProFiles 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
falbany/ProFiles#187 · 1 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
bug frontend
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
bug frontend
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
bug frontend
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
相似的 Issue
-
bug good first issue
难度 2/5 1-3 小时 新手友好度 86/100
aws-samples/sample-spec-driven-presentation-maker#648 ·
维护者通常 1 天内回复
-
firestore: enable live window.yaml pipeline system tests once add_window_fields is in production未关闭
难度 1/5 1 小时以内 新手友好度 64/100
googleapis/google-cloud-python#19115 ·
维护者通常 2 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复