Skip to content

fix(providers): prevent search panel from covering card actions - #8151

Merged
farion1231 merged 2 commits into
farion1231:mainfrom
xue-ding-e:fix/provider-search-layout
Oct 14, 2026
Merged

farion1231 merged 2 commits into
farion1231:mainfrom
xue-ding-e:fix/provider-search-layout

Conversation

@xue-ding-e

Copy link
Copy Markdown
Contributor

Summary / 概述

Fixes #8100.

搜索面板原来通过 body portal 固定在右上方,会遮住第一张供应商卡片的编辑、更多操作。改为在列表正常布局中预留面板高度,保留右对齐、最大宽度和开关动画。

新增回归测试覆盖 Ctrl/Cmd+F、筛选、编辑、Escape、清空及重复开关。没有修改搜索匹配逻辑、用户文案或 Rust 代码。

Screenshots / 截图与浏览器验收

真实 Chromium 前后对照运行及截图 artifact

  • 800×600 和 1920×1080,分别测试多条与单条匹配。
  • 修复前 4 组均复现面板与首卡操作区域重叠,按钮中心命中被遮挡;修复后 4 组均不重叠,并实际点击编辑及更多菜单。
  • 输入框保持约 349 px 可用宽度,没有被关闭按钮挤压;还验证无结果、清空、Escape、重复 Ctrl/Cmd+F、关闭按钮及滚动后重新打开时输入框可见且获焦。
  • 使用真实 ProviderList / ProviderCard / CSS、模拟 Tauri IPC 和合成供应商数据。此验证是 Linux 无头 Chromium,未声称运行 Windows WebView2 原生应用。

验收工作流与 harness 仅保存在 fork 的独立 QA 分支;本 PR 只包含组件修复和单测两个文件。QA 使用的产品代码与本 PR SHA 133dbbd5c14f14c1d3199baf9d5886215581d49f 一致。

Checklist / 检查清单

  • pnpm typecheck passes
  • pnpm format:check passes
  • Frontend unit suite: 202 files, 2435 tests passed; focused ProviderList suite: 16 passed
  • pnpm build:renderer passes
  • Rust / i18n: not applicable, no Rust or user-facing text changes

AI-assisted; patch reviewed and regression reproduced before and after the fix.

@github-actions github-actions Bot added the frontend Frontend (React/TypeScript) label Oct 11, 2026
@farion1231

Copy link
Copy Markdown
Owner

GPT-6 Astra 自动代码审查

审查提交:133dbbd5c14f14c1d3199baf9d5886215581d49f
Base:2b0ec81bb2f150ccfae7c60a462012a89c99f450

由 Codex 定时任务使用 GPT-6 Astra 子 agent 审查,并经主 agent 复核。

[P2] 移入滚动布局后,重复搜索快捷键需要重新显示输入框

位置:src/components/providers/ProviderList.tsx:463

当供应商列表长于视口时,打开搜索(可以保留空搜索词),向下滚动直到搜索面板离开视口,再点击列表非编辑区域并按 Ctrl/Cmd+F。此次改动让面板随列表滚出视口,但现有快捷键只 preventDefault 并 setIsSearchOpen(true),聚焦 effect 仅依赖 isSearchOpen;值已经是 true 时不会再次 focus,也没有滚动恢复逻辑。因此快捷键被吞掉而搜索框仍在视口外,用户只能手动滚回顶部或先关闭再重开搜索才能修改查询。原先 body portal 的 fixed 面板不会随列表滚走,因此这是移除固定定位后新出现的可达性回归,而不只是原有重复快捷键不聚焦的问题。

证据:

  • HEAD src/components/providers/ProviderList.tsx:455-463:搜索面板成为列表正常流中的 motion.div,没有 fixed 或 sticky 定位。
  • HEAD src/components/providers/mode/SwitchModePanel.tsx:539-558 和 src/App.tsx:1315-1350:两个实际调用路径都把 ProviderList 放在 overflow-y-auto scroll-stable 的滚动容器内;src/index.css:523-525 明确设置 overflow-y: scroll。
  • HEAD src/components/providers/ProviderList.tsx:230-261:Ctrl/Cmd+F 只把开关设为 true;focus/select 只在 [isSearchOpen] 变化时调度。src/App.tsx:177-180、1280-1281 使用 React state 的受控开关,未增加重复打开时的聚焦机制。
  • 无依赖 Node 验证直接提取已审阅的两个 effect 片段,以 Object.is 依赖比较模型分别执行 Ctrl/Cmd 路径:首次打开 focus 调用数 1,焦点移出后重复快捷键仍为 1,Escape 后重开为 2;重复快捷键 defaultPrevented=true。该验证是 hook 依赖模型,不是 React 或浏览器实测。
  • HEAD tests/components/ProviderList.test.tsx:343-403 的新增测试在 Escape 关闭后才再次打开,没有覆盖仍开启但已滚出视口时的重复快捷键。

建议:保留正常流布局,但在搜索已打开时收到 Ctrl/Cmd+F 也显式聚焦并将输入框滚入视口;保持对其他编辑区域的快捷键保护。补充长列表中面板保持开启、滚出视口后再次按快捷键的回归用例,不要只覆盖关闭后重开。

验证与范围

完整覆盖两文件差异、搜索状态、快捷键与实际滚动容器,确认一项 P2。主 agent 核对正常流布局、重复 setState(true)、仅依赖开关变化的聚焦 effect,以及两个 ProviderList 容器。

  • 子 agent 直接提取已审阅的两个 effect 片段,Ctrl/Cmd 两组依赖模型验证通过:首次聚焦 1 次,保持打开后重复快捷键仍为 1 次,关闭重开后为 2 次。
  • 主 agent 核对本次从 fixed portal 移至正常流是新增不可达场景的来源,未将旧的单独重复聚焦行为另报。
  • 固定快照、副本状态和 git diff --check 已核验。

未验证或受限范围:

  • 未运行项目 Vitest、类型检查、构建或 Rust 测试。
  • 最小验证为 hook 依赖模型,不是 React 或真实浏览器测试;实际滚动、动画、不同平台和窗口尺寸未端到端实测。

本评论仅针对以上提交的代码审查结果,不构成合并批准。

Copy link
Copy Markdown
Contributor Author

已在 e42caff 修复这条审查意见。搜索保持开启时,重复 Ctrl/Cmd+F 会重新 focus/select,并通过 scrollIntoView({ block: "nearest" }) 将输入框滚回可见区域;原有输入框、textarea、select、contenteditable 快捷键保护保持不变。

新增 4 组回归覆盖 Ctrl/Cmd × 受控/内部开关状态,以及连续两次重新聚焦;这些用例在修复前均因焦点未恢复失败,修复后通过。另补 4 组编辑区域保护用例。

验证:ProviderList 24/24;相关 4 个测试文件 77/77;前端全量 202 个文件、2443 个测试通过;TypeScript、改动文件 Prettier、git diff --check、renderer build 均通过。新增滚动断言基于 jsdom,验证的是显式滚动请求及焦点/选区,未对这个新提交声称真实浏览器或 Windows WebView2 GUI 验收。上游 CI 当前仍需维护者批准运行。

AI-assisted;补丁已独立复核。

@xue-ding-e
xue-ding-e marked this pull request as ready for review October 13, 2026 11:35
@farion1231

Copy link
Copy Markdown
Owner

已合并,感谢 @xue-ding-e!

把搜索面板放回列表的正常布局,首张卡片的编辑和更多按钮就不会再被挡住,这是对症的改法。Astra 指出「面板随列表滚出视口后快捷键会被吞掉」,你当天就补上了「已打开时重新聚焦并滚回可见区域」,还加了受控/非受控 × Ctrl/Cmd 的回归用例,以及不抢其他输入框快捷键的保护用例。我在合并树上跑了 typecheck 和前端全量测试,都通过;Chromium 前后对照的截图也很有说服力。

预告一下后续:我们准备把搜索框挪到列表上方第一行的最右端。有模式切换的应用放在「直连 / 路由 / 聚合」那一行,累加式应用放在「已添加 · N」那一行。这样打开搜索时卡片不会下移,也不会挡住任何按钮。你加的重新聚焦逻辑和测试会保留下来。

再次感谢,今天连着三个修复质量都很高!

@farion1231
farion1231 merged commit 49d529f into farion1231:main Oct 14, 2026
5 checks passed
farion1231 added a commit that referenced this pull request Oct 14, 2026
The search panel used to float over the list (covering the first card's
actions, #8100), and #8151 moved it into the list flow, which pushed
every card down by the panel's height when search opened. Put a compact
search field at the right end of the row that already sits above the
cards instead, so opening search neither covers nor moves anything.

- Claude Code, Codex, Gemini CLI and Grok Build: the mode row gets a
  slot next to the status text; ProviderList portals the field into it,
  keeping the search term, filtering and shortcuts in the list.
- Apps without a mode row: the first section title ("Added · N") and
  the field share the list's first row, which always reserves the field
  height. With no matches only the field remains, and the input stays
  the same node so typing keeps focus. Lists without a section title
  (Claude Desktop) show the row only while searching.
- The scope and Esc hints move into the input's tooltip.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Frontend (React/TypeScript)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][Windows][Codex] 搜索浮层遮挡首个供应商操作按钮

2 participants