Skip to content

Show a handoff screen instead of a QR code on a handheld - #4

Merged
MadsenDev merged 1 commit into
mainfrom
phone-handoff-state
Aug 8, 2026
Merged

Show a handoff screen instead of a QR code on a handheld#4
MadsenDev merged 1 commit into
mainfrom
phone-handoff-state

Conversation

@MadsenDev

Copy link
Copy Markdown
Contributor

Opening the site on a phone produced a QR code with the instruction to scan it with a phone — a dead end, since the device meant to scan it is the one already displaying it.

The previous attempt at this was a grey .footnote appended below the card, so on a phone it sat underneath a full-size QR code and was never seen. Being present in the bundle is not the same as being visible.

What changes

A handheld arriving without a pairing link now gets a screen naming the address to open on the computer, and no session is created — one nobody can pair to only burns the per-IP create limit.

The role is still decided by the pairing fragment alone. The device query chooses which screen the receiver opens on, never who the page becomes: a phone that arrives with a pairing link still goes straight to the scanner. Because the guess can be wrong (a tablet at a counter, desktop mode, an odd viewport) the screen carries a one-tap escape hatch, and a stored session is honoured without asking again.

Verification

pointer: coarse cannot be exercised by curl, and both recent bugs here came from never rendering the page — so this was checked in headless Chromium with device emulation:

Client Result
iPhone 13, no link handoff screen, no QR, address shown, escape hatch present
Desktop 1280×800 unchanged — session created, QR drawn
iPhone 13 + /p#s=…&t=… routes to the scanner, not the handoff

64 tests still pass.

🤖 Generated with Claude Code

Opening the site on a phone produced a QR code with the instruction to scan it
with a phone — a dead end, since the device meant to scan it is the one already
displaying it. The previous attempt at this was a grey footnote appended below
the card, so on a phone it sat under a full-size QR code and was never seen.

A handheld that arrives without a pairing link now gets a screen naming the
address to open on the computer, and no session is created: one nobody can pair
to only burns the per-IP create limit.

The role is still decided by the pairing fragment alone. The device query
chooses which screen the receiver opens on, never who the page becomes — a
phone that arrives *with* a pairing link still goes straight to the scanner.
Because the guess can be wrong (a tablet at a counter, desktop mode, an odd
viewport) the screen carries a one-tap escape hatch, and a stored session is
honoured without asking again.

Verified in headless Chromium with device emulation, since `pointer: coarse`
cannot be exercised by curl and both recent bugs here came from never rendering
the page: iPhone 13 with no link gets the handoff and no QR; desktop still gets
a session and a QR; iPhone 13 with a pairing link still routes to the scanner.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@MadsenDev
MadsenDev merged commit 04ff060 into main Aug 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants