Global shortcuts fire while barcode mode is active (P opens Properties, Enter launches the selected file)

未关闭 适合新手
#187 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
javascript, python, react
领域
desktop, tooling

调研方向

先阅读 issue 中指出的相关监听器 useBarcodeMode 和 useGlobalShortcuts。选择一个文件后重现 p 和 Enter 的情况,然后检查条码模式测试的覆盖情况。当已处理的 wedge 输入不再触发全局快捷键,而 Escape 和缓冲区为空时的 Enter 仍会继续传播时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

Repro (no barcode scanner needed)
  1. Have at least one file listed and selected.
  2. Ctrl+B → barcode mode ON.
  3. Blindly type filter=.pdf → typing the p opens the Properties modal of the selected file (the char is also accumulated into the wedge buffer).
  4. Or blindly type filter=.md, then Enter → the filter is applied, but the same Enter also executes/opens the selected file (global Enter shortcut).
Root cause

useBarcodeMode's document-level capture-phase keydown listener consumes wedge-scanner keystrokes (printable accumulation, Enter with a non-empty buffer) but never calls stopPropagation(). Every keydown therefore still reaches the global-shortcuts window listener (useGlobalShortcuts), whose colliding branches are:

  • plain p (no modifiers) with a selected file → Properties modal
  • plain ? → shortcuts modal
  • Enter with a selected file → execute/launch

A real USB/wedge scanner typing a payload hits the exact same leaks — this is not specific to manual typing.

This predates the #148 refactor (the same two listeners coexisted inline in pre-refactor App.tsx; verified at main and at 332e951). The decomposition preserved it verbatim under the "quirks survive" policy, and the characterization tests only exercised barcode input on an empty file list, where both leaks were harmless no-ops.

Proposed fix

stopPropagation() on exactly the keys the wedge handler consumes (printable accumulate; Enter with a non-empty buffer). Escape and empty-buffer Enter keep propagating, preserving modal-close and manual-execute behavior.

主要语言
Python
星标
1
派生
1
平均合并
4 小时 46 分钟
30 天内合并 PR
55

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

falbany/ProFiles 的其他 Issue

查看 falbany/ProFiles 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。