feat(devtools): 机型选择支持全部 171 台设备并改为可搜索对话框 - #200
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1761aabd47
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
模拟器面板原来只列 @devicekit/devices 的少数经典机型,下拉列表也放不下更多。现在改为全部 DEVICES,并把下拉换成 cmdk 搜索对话框:按名称、系统、尺寸搜索(尺寸同时索引 393x852 和界面显示的 393×852),按 iOS / Android / HarmonyOS 与手机 / 平板筛选,打开时预高亮当前机型,直接回车不会跳到列表第一行。 CommandDialog 新增 title、trigger、commandProps:标题以视觉隐藏的 DialogTitle 提供无障碍名称;触发按钮放进同一个 Dialog root,关闭后焦点回到按钮而不是丢到 body。 simulator-panel 的 onDeviceChange 改为传机型名字符串,use-device 用 findDevice 解析,找不到时回退到 DEFAULT_DEVICE。 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
对话框原来由主窗口渲染进程画,而模拟器是挂在它之上的 WebContentsView,居中的面板左侧被切掉一块(实测对话框 x 384-896 与模拟器 x 0-437 重叠),CSS z-index 跨不过这层边界。现在照 projectCreateDialog 的模板做成 device-picker 覆盖视图,层级 dialog(40),整窗覆盖;DevicePicker 本身改成常开的纯组件,开关由主进程挂载/撤下视图决定,选择结果经 IPC 回给 use-device。e2e 里对原生 select 的驱动一并迁到覆盖视图自己的 WebContents。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
lbb00
force-pushed
the
feat/device-picker-search
branch
from
September 7, 2026 05:00
1761aab to
4d9d240
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改了什么
模拟器面板原来只列
@devicekit/devices里的少数经典机型,一个下拉列表放不下 171 台。现在:DEVICES(171 台,含 19 台平板)。393x852和界面显示的393×852;按 iOS / Android / HarmonyOS 与手机 / 平板两组 chip 筛选;分组展示,当前机型有勾选标记,平板带标签。z-index跨不过这层边界。现在照projectCreateDialog的模板接成VIEW_ID.devicePicker覆盖视图,层级dialog(40)、整窗覆盖。DevicePicker本身变成常开的纯组件(device / devices / onSelect / onClose),开关由主进程挂载或撤下视图决定,选择结果经 IPC 回给use-device——设备状态本来就归它,弹层归属跟着状态 owner 走。simulator-panel回到纯展示:只通过onOpenDevicePicker上报点击,自身不再渲染任何机型列表。已知限制
关闭面板后焦点不会回到工具栏的机型按钮。触发按钮和面板现在分属两个 WebContents,组件还不回去。仓库里其它 overlay(popover、compile-mode、project-create dialog)关闭路径同样没有焦点归还,这是它们共同的既有行为,本 PR 没有单独为机型选择开特例。
验证
device-picker.test.tsx保留全部 171 台渲染、搜索(含×)、chip 筛选、当前机型标记与预高亮、回车保持当前机型、对话框无障碍名称;原先断言"对话框自己消失"的几条改为断言上报onSelect/onClose,因为关闭已由主进程撤视图完成。新增device-picker-panel.test.tsx、use-device的三条弹层用例、view-manager-dialog-zorder的 picker-above-simulator 用例。./scripts/gate.sh:lint / typecheck / test / pawl 四项全过(GATE_EXIT=0)。device-picker-overlay.spec.ts(真实 z-order 与 bounds、搜索选型、复用后状态复位);device-frame-integration、window-info-follows-device、native-host-white-screen-reconcile、devtools-panel四个 spec 由驱动原生<select>迁到驱动覆盖视图自己的 WebContents,共 22 条通过。contentView.children,数组顺序即绘制顺序):面板打开时device-picker/index.html排在 simulator 之后、整窗 1280×948 覆盖;对话框自身 x 384–896 / y 280–668,与 simulator 的 x 0–437 真实重叠——正是原缺陷被切掉的那块。用户路径三段有断言:搜索机型名 → 点中行 → 工具栏按钮标签与 simulator 的device属性都变为Pixel 8;再开一次搜索框为空、data-current落在Pixel 8上。×不匹配、关闭后焦点丢失、缺 DialogTitle、键盘路径没测试)已修;第二轮 4 条——面板被模拟器遮挡、e2e 仍驱动已删除的原生<select>、注释引用不存在的DESIGN.md、文档机型表过期——均已修,遮挡一条的修法即上面的 overlay 迁移。🤖 Generated with Claude Code