diff --git a/src/__tests__/runtime-interactions.test.ts b/src/__tests__/runtime-interactions.test.ts index 6d0f8a11b..d8b021e9c 100644 --- a/src/__tests__/runtime-interactions.test.ts +++ b/src/__tests__/runtime-interactions.test.ts @@ -609,16 +609,36 @@ test('runtime gesture swipe presets use stable viewport lanes', async () => { session: 'default', }); - assert.deepEqual(pageSwipe.from, { x: 90, y: 65 }); - assert.deepEqual(pageSwipe.to, { x: 10, y: 65 }); + assert.deepEqual(pageSwipe.from, { x: 85, y: 65 }); + assert.deepEqual(pageSwipe.to, { x: 15, y: 65 }); assert.deepEqual(edgeSwipe.from, { x: 8, y: 50 }); assert.deepEqual(edgeSwipe.to, { x: 85, y: 50 }); assert.deepEqual(calls, [ - { from: { x: 90, y: 65 }, to: { x: 10, y: 65 }, durationMs: 300 }, + { from: { x: 85, y: 65 }, to: { x: 15, y: 65 }, durationMs: 300 }, { from: { x: 8, y: 50 }, to: { x: 85, y: 50 }, durationMs: 350 }, ]); }); +test('runtime iOS in-page swipe presets avoid edge-navigation lanes', async () => { + const calls: unknown[] = []; + const device = createInteractionDevice(snapshotWithOffscreenContent(), { + platform: 'ios', + swipe: async (_context, from, to, options) => { + calls.push({ from, to, durationMs: options?.durationMs }); + }, + }); + + const pageSwipe = await device.interactions.swipe({ + preset: 'right', + durationMs: 300, + session: 'default', + }); + + assert.deepEqual(pageSwipe.from, { x: 15, y: 65 }); + assert.deepEqual(pageSwipe.to, { x: 85, y: 65 }); + assert.deepEqual(calls, [{ from: { x: 15, y: 65 }, to: { x: 85, y: 65 }, durationMs: 300 }]); +}); + test('runtime viewport gestures reject inspect-only macOS surfaces', async () => { for (const surface of ['desktop', 'menubar'] as const) { const device = createInteractionDevice(selectorSnapshot(), { diff --git a/src/core/__tests__/dispatch-interactions.test.ts b/src/core/__tests__/dispatch-interactions.test.ts index 040966472..16417e59d 100644 --- a/src/core/__tests__/dispatch-interactions.test.ts +++ b/src/core/__tests__/dispatch-interactions.test.ts @@ -100,11 +100,11 @@ test('handleSwipePresetCommand resolves Android in-page swipe to content lane', undefined, ); - assert.deepEqual(calls, [[360, 520, 40, 520, 300]]); + assert.deepEqual(calls, [[340, 520, 60, 520, 300]]); assert.deepEqual(result, { - x1: 360, + x1: 340, y1: 520, - x2: 40, + x2: 60, y2: 520, preset: 'left', durationMs: 300, diff --git a/src/core/scroll-gesture.ts b/src/core/scroll-gesture.ts index b87a4cecb..5aa161b3f 100644 --- a/src/core/scroll-gesture.ts +++ b/src/core/scroll-gesture.ts @@ -109,12 +109,14 @@ export function buildSwipePresetGesturePlan( options: { platform?: string; marginPx?: number } = {}, ): SwipePresetGesturePlan { const marginPx = options.marginPx ?? 8; - const horizontalLanePercent = options.platform === 'android' ? 65 : 50; + const horizontalLanePercent = 65; + const inPageStartPercent = 85; + const inPageEndPercent = 15; const [startPercent, endPercent, yPercent] = preset === 'left' - ? [90, 10, horizontalLanePercent] + ? [inPageStartPercent, inPageEndPercent, horizontalLanePercent] : preset === 'right' - ? [10, 90, horizontalLanePercent] + ? [inPageEndPercent, inPageStartPercent, horizontalLanePercent] : preset === 'left-edge' ? [99, 15, 50] : [1, 85, 50];