UI: enable the back-swipe inside Telegram (fix lost swipe-back)
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Has been skipped
CI / integration (pull_request) Has been skipped
CI / ui (pull_request) Successful in 41s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 57s

The gesture was disabled inside Telegram on the mistaken assumption it would
fight a Telegram horizontal close gesture — but Telegram's only close/minimise
gesture is vertical (disableVerticalSwipes, Bot API 7.7+). Disabling it there,
together with dropping the old left-edge swipe, removed every swipe-back in
Telegram (which that edge-swipe — deliberately enabled in TG, commit 7e34897 —
had provided).

Make shouldArm Telegram-agnostic (drop the insideTelegram guard + its now-unused
import); the gesture works in Telegram too, alongside the native BackButton.
Drop the redundant overscroll-behavior-x on .router (body already sets
overscroll-behavior: none). Regression: an e2e drives the swipe under an
injected Telegram WebApp stub and asserts it navigates back.
This commit is contained in:
Ilia Denisov
2026-06-11 16:57:34 +02:00
parent 6d263ff7c6
commit de11ae46a2
6 changed files with 41 additions and 13 deletions
+33
View File
@@ -22,6 +22,22 @@ async function openAnnGame(page: Page): Promise<void> {
await page.waitForTimeout(400); // let the open slide settle before measuring/aiming
}
// A minimal Telegram WebApp stub: non-empty initData makes insideTelegram() true and drives
// the Mini App auto-auth into the lobby (the mock gateway accepts any initData).
function telegramStub() {
return {
Telegram: {
WebApp: {
initData: 'query_id=test&user=%7B%22id%22%3A1%7D&auth_date=1&hash=deadbeef',
initDataUnsafe: {},
themeParams: {},
ready() {},
expand() {},
},
},
};
}
/** touchDrag dispatches a single-finger touch drag from (x0,y0) to (x1,y1) over the window. */
async function touchDrag(page: Page, x0: number, y0: number, x1: number, y1: number): Promise<void> {
await page.evaluate(
@@ -88,3 +104,20 @@ test('a vertical drag in the band scrolls instead of navigating', async ({ page
await page.waitForTimeout(300);
expect(page.url()).toContain('/game/');
});
test('the back-swipe also works inside Telegram (its only swipe gesture is vertical)', async ({ page }) => {
await page.addInitScript((stub) => {
Object.assign(window, stub);
}, telegramStub());
await page.goto('/');
// Telegram auto-authenticates into the lobby (no guest click), then open the seeded game.
await page.getByRole('button', { name: /Ann/ }).click();
await expect(page.locator('[data-cell]').first()).toBeVisible();
await page.waitForTimeout(400);
await touchDrag(page, START_X, MID_Y, 300, MID_Y);
await expect(page).toHaveURL(/#\/$/);
await expect(page.getByRole('button', { name: /Ann/ })).toBeVisible();
});