Skip to content

Fix mouse drags, and stop warning about a secure context that exists - #4

Merged
paulglover merged 3 commits into
mainfrom
drag-and-note
Aug 10, 2026
Merged

Fix mouse drags, and stop warning about a secure context that exists#4
paulglover merged 3 commits into
mainfrom
drag-and-note

Conversation

@paulglover

Copy link
Copy Markdown
Owner

Two independent small fixes, both found while running the app locally.

Mouse drags never worked

An <img> is natively draggable, so a press-and-move on a desktop started an HTML5 drag-and-drop, which fires pointercancel — the image springs back a few pixels into the gesture and no swipe ever resolves. draggable="false" on #photo, plus -webkit-user-drag: none because Safari has long wanted the property as well as the attribute.

Touch never starts a native drag, which is why this was invisible on the platform the app was written for.

The secure-context note fired on loopback

main.go printed "reached by LAN IP over http, the screen will sleep and fullscreen is unavailable" whenever TLS was off — including on 127.0.0.1:6969, where localhost is a secure context and both features work. It advised a certificate for a problem the deployment did not have.

loopbackOnly answers false for everything uncertain: a bare port is every interface, a hostname other than localhost can resolve anywhere, an unparseable address is about to fail at Listen anyway. A redundant note costs a line of log; a missing one sends someone hunting for why the screen keeps sleeping. main_test.go covers the table, including 127.0.0.2 and [::1].

Verified

Both against a running server, not just read:

bind :6969          → listening on http://localhost:6969
                      note: reached by LAN IP over http …
bind 127.0.0.1:6969 → listening on http://127.0.0.1:6969
                      (no note)

and the rebuilt binary serves draggable="false" and -webkit-user-drag from the embedded assets. The drag behaviour itself still wants a human with a mouse — there's no browser automation on this machine.

🤖 Generated with Claude Code

https://claude.ai/code/session_01T4oAqvh4CPXFK2uWJnSXpa

paulglover and others added 3 commits August 10, 2026 17:55
An <img> is natively draggable, so a press-and-move on a desktop started an
HTML5 drag-and-drop, which fires pointercancel and springs the image back a
few pixels into the gesture. Every swipe on a desktop was dead, and touch was
unaffected — a native drag never starts from a touch — which is why it went
unnoticed on the platform this was written for.

Both the attribute and the -webkit- property: Safari has long wanted the
property as well. There is no unprefixed form; it is not a standard property.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T4oAqvh4CPXFK2uWJnSXpa
The note was printed whenever TLS was off, including on a loopback bind —
where localhost *is* a secure context, Wake Lock and Fullscreen both work, and
the note advised a certificate for a problem the deployment did not have.

Everything uncertain still warns. A bare port is every interface, a hostname
other than localhost can resolve anywhere, and an unparseable address is about
to fail at Listen regardless. A redundant note costs a line of log; a missing
one sends someone hunting for why the screen keeps sleeping.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T4oAqvh4CPXFK2uWJnSXpa
Two invariants that look like tidiness and are not: draggable="false" is the
only reason a desktop swipe works at all, and keyOutcome/swipeOutcome share a
vocabulary on purpose.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T4oAqvh4CPXFK2uWJnSXpa
@paulglover
paulglover merged commit 6d94412 into main Aug 10, 2026
1 check passed
@paulglover
paulglover deleted the drag-and-note branch August 10, 2026 21:56
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