Skip to content

fix(search): 浮窗前台时 ⌘1~9/Enter 无需焦点在浮窗内即生效 - #1997

Open
lqtdys wants to merge 1 commit into
mainfrom
fix/1987-search-shortcut-focus
Open

lqtdys wants to merge 1 commit into
mainfrom
fix/1987-search-shortcut-focus

Conversation

@lqtdys

@lqtdys lqtdys commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

关联

fixes #1987

影响

搜索浮窗前台可见时,⌘19 直达、Enter 定位无需焦点在浮窗内(spec S-5);焦点在浮窗外的普通输入框时不劫持;浮窗关闭后 ⌘19 恢复全局卡片直开。

验证(先红后绿)

  • 先红:焦点在编辑器按 ⌘3 → Expected: 2, Received: 0(3 例失败)
  • 绿:e2e/search-shortcut-global.spec.ts 4 passed
  • npx tsc --noEmit 0;npx eslint src/ 0 error;vitest localHotkeys/shortcuts 17 passed
  • 既有 search-float + arrowkeys 73 passed;1 pre-existing fail(search-float.spec.ts:1483 圆角 8 vs 12,stash 对照无关)

备注

WKWebView 下浮窗前台 + 编辑器聚焦的 ⌘N 行为建议真机复验。

搜索浮窗打开且前台可见时,焦点在编辑器按 ⌘1~9 / Enter 无法定位:
根节点 capture 键处理只在焦点在浮窗内触发,⌘1~9 落到全局卡片直开。

仿既有 ↑↓ 的 document 级 capture 处理器,新增 ⌘1~9 直达与 Enter 定位
分支:浮窗打开 + 所属窗格可见 + 焦点不在浮窗内 + 焦点不在浮窗外的普通
可编辑元素内时拦截,stopPropagation 阻止全局 card-open 抢占;焦点在
浮窗内仍走根节点 capture,不重复处理。关闭浮窗即随 effect 解绑。

e2e:新增 search-shortcut-global.spec.ts 覆盖编辑器聚焦 ⌘3/Enter、
浮窗外输入框不劫持、关闭后无残留。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk-low CI 绿自动合并

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] 搜索浮窗前台时 ⌘1~9/Enter 需焦点在输入框才生效

1 participant