Skip to content

docs: keep swipes from a phone's screen edges in the app - #28

Merged
kalaspuff merged 2 commits into
mainfrom
fctl/1039-on-mobile-could-we-make-it-so-that-swipi
Nov 9, 2026
Merged

kalaspuff merged 2 commits into
mainfrom
fctl/1039-on-mobile-could-we-make-it-so-that-swipi

Conversation

@fctl-sh

@fctl-sh fctl-sh Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Describes fctl#492 in the shell's page: on a phone in WebKit, a touch that starts within 24 px of the left or right edge of the screen is cancelled as it starts, so that Safari doesn't go back or forward, and the app does its tap and scroll itself. The page says where it applies, what stays the browser's, what is lost at the edges and what it costs, and the edge drag's section now says the drawer comes in from the very edge on an iPhone.

Known gaps gain the one thing not yet confirmed: whether a cancelled touch stops the swipe on a real iPhone, in Safari and in the installed app. Checking it says how to drive edge swipes in Playwright.

fctl session


Note

Low risk. It only changes one design document, docs/web-app/shell.md; no code or published API changes.

What it does. Documents the new edge-swipe handling that keeps swipes from a phone's left and right screen edges inside the app, so Safari's back and forward swipes no longer fight the drawer's drag. It describes where and how the app takes over those touches, what stays with the browser and what is lost at the edges. It also adds a checklist item, a known-gap note that this has not been tried on a real iPhone, and a recipe for testing edge swipes.

fctl review's first look at ee647fc · 1 file, +50 −4 · Review agent settings

@fctl-review

This comment has been minimized.

Comment thread docs/web-app/shell.md Resolved
@kalaspuff
kalaspuff merged commit f387715 into main Nov 9, 2026
4 checks passed
@kalaspuff
kalaspuff deleted the fctl/1039-on-mobile-could-we-make-it-so-that-swipi branch November 9, 2026 15:46
kalaspuff pushed a commit to hyperstructure/fctl that referenced this pull request Nov 9, 2026
## Summary

On a phone, Safari no longer takes a swipe from the left or right edge
of the screen for going back or forward, and neither does any other
browser on an iPhone (they are all WebKit). The left edge now drags the
sidebar's drawer in from the very edge, and the right edge stays on the
page. A page can stop those swipes only by cancelling the touch as it
starts, which also cancels the browser's tap and scroll. So for a touch
that starts within 24 px of either edge, the app does those itself. A
tap presses and clicks what it touched, moving the focus as a press
does. A swipe scrolls what is under it, even when it starts out partly
sideways, goes on to the page past something already at its end, and
glides on after the finger lifts; the touch that stops the glide clicks
nothing. Touches on a video's controls or a slider stay the browser's.
In Chrome on a phone, `overscroll-behavior-x: none` on the root stops
Chrome's own swipe navigation. Android's system back gesture takes the
touch before the page sees it, so it still goes back there.

Unit tests cover the edge band, the glide, what a swipe scrolls and what
a tap sends, and shell tests drive touches through the drawer, taps,
scrolling, glides and long presses. In Chromium at an iPhone's size,
with real touch events and WebKit stood in, edge taps opened the menu,
closed the shade and followed a sidebar link. A drag from 2 px in opened
the drawer, and edge swipes scrolled, glided on and stopped under a new
touch, while history never changed. Only touches at the edges were
cancelled. In Playwright's WebKit, an edge tap clicked once: the app's
click, with WebKit's own suppressed. `cargo xtask check web` passes.

The design docs describe it in hyperstructure/design:

- hyperstructure/design#28
- hyperstructure/design#29

## Worth confirming

- **Assumption:** cancelling a touch as it starts stops the edge swipe
on a current iPhone, in Safari and in the installed app. It is the known
way (reported since iOS 13.4, and still in 2025), but I couldn't try a
device, and WebKit's source suggests its own back swipe doesn't wait for
the page. If a swipe from the edge still goes back there, the app's taps
and scrolls at the edges do nothing useful: worth trying on your iPhone
once it is deployed.
- **Decision:** it applies in WebKit on screens under 768 px either way:
phones, held either way (in landscape there is no drawer, but the edges
still stay in the app), and an iPad's narrow window. On a full-width
iPad, Safari's swipes still go back and forward.
- **Decision:** in the 24 px at each edge (Safari takes about 25), a
long press shows nothing (no link preview, no text selection) and, on a
link, clicks nothing; a tapped text field doesn't put the caret where
the finger was; and a scroll stops at its end without the rubber band.
- **Decision:** on an iPhone, the browser now waits for the page's
`touchstart` handler before it scrolls any touch. The handler returns at
once away from the edges, but while the page is busy (a session
streaming in), a scroll may start a little late.

[fctl session](https://app.fctl.sh/s/ses_01M70DWRMWQQMWSHFH2W3Q9Z2Q)

<!-- FCTL_REVIEW_SUMMARY -->
---

> [!NOTE]
> **Medium risk.** It cancels every touch that starts in the 24 px edge
bands on phones in WebKit and re-implements taps, focus, scrolling and
glides by hand, so any gap in that imitation shows as a broken tap or
scroll for all iPhone users.
>
> **What it does.** On iPhones, Safari goes back or forward when a
finger swipes in from the left or right screen edge. This keeps those
swipes in the app by cancelling touches that start within 24 px of
either edge, and doing by hand what the browser would have done: clicks
(with mouse events and focus), scrolling the nearest scroller or the
page, and gliding on after the finger lifts. The left edge still drags
the sidebar's drawer in, and tablets, computers and non-WebKit browsers
are unchanged.
>
> **Hand-made touch handling.** Taps, focus changes, scroll chaining at
a scroller's end, and glides are re-created in `edge-swipes.ts`, so they
are worth trying on a real iPhone.
>
> <sub>[fctl
review](https://app.fctl.sh/s/ses_01M70GDSVBHKC3J304AK3HQ4E0)'s first
look at
[`8ee3214`](8ee3214)
· 6 files, +764 −6 · [Review agent
settings](https://app.fctl.sh/p/fctl?tab=reviews)</sub>

<!-- /FCTL_REVIEW_SUMMARY -->

---------

Co-authored-by: fctl-sh[bot] <fctl-sh[bot]@users.noreply.github.com>
kalaspuff pushed a commit that referenced this pull request Nov 9, 2026
## Summary

Brings the shell page's edge swipes in line with fctl#492 after its
review fixes, which landed after design#28 merged. An edge tap now
presses the mouse down and up before it clicks, moving the focus as a
press does, so dialogs that close on a press and a click beside them
close and a tap elsewhere takes the focus from a text field. A slow
press still clicks, except on a link, where Safari would show its menu.
A swipe that starts out partly sideways scrolls what scrolls the other
way, one over something already at its end goes on to what is around it,
and the touch that stops a glide is the app's wherever it is and clicks
nothing.

- hyperstructure/fctl#492
- #28

[fctl session](https://app.fctl.sh/s/ses_01M70DWRMWQQMWSHFH2W3Q9Z2Q)

<!-- FCTL_REVIEW_SUMMARY -->
---

> [!NOTE]
> **Low risk.** It only edits one bullet list in the design doc
`docs/web-app/shell.md`; no code, tokens or exports change.
>
> **What it does.** Updates the shell page's description of how the app
handles touches that start at a phone's screen edges, to match fctl#492
after its review fixes. A tap now sends the mouse down and up before the
click and moves the focus as a real press does. A slow press still
clicks, except on a link held over 500 ms. A swipe that starts out
partly sideways scrolls what scrolls the other way, one over something
already at its end passes on to what is around it, and the touch that
stops a glide clicks nothing.
>
> <sub>[fctl
review](https://app.fctl.sh/s/ses_01M70GEH899E6QWATR4HS4K8FT)'s first
look at
[`6beb18f`](6beb18f)
· 1 file, +17 −7 · [Review agent
settings](https://app.fctl.sh/p/fctl?tab=reviews)</sub>

<!-- /FCTL_REVIEW_SUMMARY -->

---------

Co-authored-by: fctl-sh[bot] <fctl-sh[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant