Skip to content

fix: only hand the link to the OS share sheet on a touch device - #14

Merged
simien merged 2 commits into
mainfrom
fix/share-sheet-desktop
Oct 2, 2026
Merged

simien merged 2 commits into
mainfrom
fix/share-sheet-desktop

Conversation

@simien

@simien simien commented Oct 2, 2026

Copy link
Copy Markdown
Owner

What was wrong

Desktop Chromium exposes navigator.share, so Brave and Chrome on macOS relabelled the button Share and opened the macOS share sheet. That sheet offers Mail, Messages, Notes and Reminders and no clipboard entry, which left no way to get the link out of a button that used to say Copy Link. Safari on macOS took the same branch.

The fix

Gate the sheet on (pointer: coarse) rather than on the API existing. A phone still gets the sheet, every desktop browser goes back to copying the link and showing the toast.

A failed share now falls through to the clipboard too. The old catch swallowed every error, so anything but a cancelled sheet left the button doing nothing at all; only AbortError returns early now.

The sitemap lastmod for / moves to today, which checks.py requires whenever index.html changes.

Verification

  • checks.py origin/main passes, including the link-format and cache-bust checks. No versioned file changed, so no ?v= bump.
  • (pointer: coarse) reads false at desktop size and true under touch emulation, so the gate separates the two cases.
  • The clipboard write itself could not be exercised in the browser pane: navigator.clipboard.writeText throws NotAllowedError there because the pane's document is never focused. Worth pressing the button in Brave, and on a phone to confirm the share sheet still appears, before merging.

🤖 Generated with Claude Code

Desktop Chromium exposes navigator.share, so Brave and Chrome on macOS
relabelled the button Share and opened the macOS sheet. That sheet offers
Mail, Messages, Notes and Reminders and no clipboard entry, which left no
way to get the link out of a button that used to say Copy Link. Safari on
macOS took the same wrong branch.

Gate the sheet on (pointer: coarse) rather than on the API existing. A
phone still gets the sheet; every desktop browser goes back to copying
the link and showing the toast.

Also let a failed share fall through to the clipboard. The old catch
swallowed every error, so anything but a cancelled sheet left the button
doing nothing at all; now only AbortError returns early.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
flield 54910cb Commit Preview URL

Branch Preview URL
Oct 02 2026, 07:23 PM

The comment above the button still said the label swaps wherever the OS
share sheet is available, which is the rule that caused the bug. AGENTS.md
gains the trap itself: the API exists on desktop, the sheet it opens there
has no clipboard entry, and the pane cannot verify the copy path because
its document is never focused.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@simien
simien merged commit fb34a5e into main Oct 2, 2026
2 checks passed
@simien
simien deleted the fix/share-sheet-desktop branch October 2, 2026 19:24
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.

1 participant