Skip to content

fix(settings): open the AI tab pickers as in-app menus - #410

Merged
vastsa merged 1 commit into
vastsa:mainfrom
catDforD:fix/settings-select-controls
Sep 15, 2026
Merged

vastsa merged 1 commit into
vastsa:mainfrom
catDforD:fix/settings-select-controls

Conversation

@catDforD

Copy link
Copy Markdown
Contributor

Closes #405

设置 → 全局 AI 的「权限模式」和「命令 Shell」此前用原生 <select> 渲染,弹层由操作系统绘制——方角、系统默认高亮、不跟随主题、没有当前项标记——和同一个设置窗口「常规」页的主题/语言选择器明显不是一套东西。本 PR 新增 SettingsMenuSelect(基于仓库已有的 AnchoredMenu),把这两行切到共享的应用内菜单:外观、键盘行为(方向键循环、Escape 与外部点击关闭并归还焦点)与读屏语义都与外观页选择器一致。

不可用的命令 Shell 仍会列出并保持禁选,标签仍带「不可用」后缀;保存进行中触发器仍禁用。未改动持久化字段、IPC/RPC 契约、Plugin SDK 与权限逻辑。其余仍在使用原生 <Select> 的位置(模型配置、供应商对话框、插件设置等约 11 处)不在本 PR 范围。

同步文档:04-ux/06-settings-ia.md 中英两版写明这两行的控件形态;E2E 计划新增场景 E2E-SETTINGS-ai-tab-pickers-use-in-app-menus;源码契约测试补上「AI 页不再出现原生 <select>」的断言,fixed-dropdown-surfaces 的表单加入新的菜单表面类名。

截图

QQ_1789473677981 QQ_1789473635373 QQ_1789473649596

验证

检查 结果
pnpm build:js 通过
pnpm --filter @pi-desktop/desktop typecheck 通过
pnpm lint 通过
pnpm --filter @pi-desktop/desktop test 1909 项:1908 通过,0 失败,1 跳过(macOS 专用用例)
pnpm -r --filter '!@pi-desktop/docs' --if-present test 通过(plugin-sdk 288 / i18n 24 / shared 658 / plugin-devkit 46 / agent-host 39 / agent-runtime 452)
node scripts/check-architecture.mjs --base origin/main 通过
pnpm test:e2e:theme-surfaces 通过,6 组主题检查 failures 全为空

真实 Chromium 加载生产 CSS 对比过:新触发器与外观页主题触发器的计算样式一致(高度 30px、圆角 full、同一 raised 背景与阴影),菜单为 fixed 定位、240px 宽、radius-lg 圆角与 elevation token,深浅两套主题均通过,页面上不存在 <select> 元素。

Settings → 全局 AI rendered the permission mode and the command shell as
native `<select>` popups, so one Settings window mixed two picker
implementations: the Appearance rows open the shared anchored menu, while
these two opened a platform-drawn menu with OS chrome, no theme tokens,
and no current-value marker.

Add `SettingsMenuSelect` on top of the shared `AnchoredMenu` and use it for
both rows. It reuses the Appearance picker styles in one definition, keeps
host-unavailable command shells listed but disabled, and keeps the previous
disabled treatment while a write is in flight.

Specs and E2E:
- 04-ux/06-settings-ia.md documents the control for both rows.
- Adds E2E-SETTINGS-ai-tab-pickers-use-in-app-menus.
- The AI tab source contract now asserts no native `<select>` remains.

Refs vastsa#405
@vastsa
vastsa merged commit 69a3b1c into vastsa:main Sep 15, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants