fix(touch): harden long-press for iOS (#199) #440

Merged
jared merged 1 commits from fix/ios-long-press into lotus 2026-10-20 20:47:19 -04:00
Owner

Refs #199 and #166. It doesn't close them: per the owner's note they close together after a real-iPhone check.

Decision (owner, 2026-10-20): keep long-press → bottom sheet as the touch path, with nothing added per message, and harden it for iOS.

Why iOS was unreliable: a long-press on iOS belongs to the system. On a link or image it opens the callout or preview, and on text it starts the selection loupe at about 500 ms. Both race the 450 ms press, and often win.

Changes

  • useLongPress (touch screens only): its handlers add data-touch-actions to the message row, and the pressed row gets data-pressing from touch-down until the finger lifts. The attribute is set on the DOM directly, so no re-render. It stays set after the sheet opens, so the selection can't start under a finger that's still down.
  • Global rules in room/message/styles.css.ts:
    • [data-touch-actions] { -webkit-touch-callout: none };
    • [data-touch-actions][data-pressing] { user-select: none }, so text selection is off only during the press.
  • Copy Text stays in the sheet.

Verified (Chromium iPhone 14 emulation, real touch events over CDP; T = finger down):

pressing user-select sheet
at rest – auto –
T + 150 ms yes none –
T + 750 ms (still holding) yes none open
after lift – auto open
short tap – auto –
touch + move 60 px (scroll) – auto –

The served stylesheet contains -webkit-touch-callout: none (Chromium doesn't implement the property, so only Safari applies it).

Still needed: a real iPhone check (Safari and the installed PWA) of long-press on plain text, a link and an image.

🤖 Generated with Claude Code

https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5

Refs #199 and #166. It doesn't close them: per the owner's note they close together after a real-iPhone check. **Decision** (owner, 2026-10-20): keep long-press → bottom sheet as the touch path, with nothing added per message, and **harden it for iOS**. **Why iOS was unreliable:** a long-press on iOS belongs to the system. On a link or image it opens the callout or preview, and on text it starts the selection loupe at about 500 ms. Both race the 450 ms press, and often win. **Changes** - `useLongPress` (touch screens only): its handlers add `data-touch-actions` to the message row, and the pressed row gets `data-pressing` from touch-down **until the finger lifts**. The attribute is set on the DOM directly, so no re-render. It stays set after the sheet opens, so the selection can't start under a finger that's still down. - Global rules in `room/message/styles.css.ts`: - `[data-touch-actions] { -webkit-touch-callout: none }`; - `[data-touch-actions][data-pressing] { user-select: none }`, so text selection is off only during the press. - Copy Text stays in the sheet. **Verified** (Chromium iPhone 14 emulation, real touch events over CDP; T = finger down): | | pressing | user-select | sheet | |---|---|---|---| | at rest | – | auto | – | | T + 150 ms | yes | none | – | | T + 750 ms (still holding) | yes | none | **open** | | after lift | – | auto | open | | short tap | – | auto | – | | touch + move 60 px (scroll) | – | auto | – | The served stylesheet contains `-webkit-touch-callout: none` (Chromium doesn't implement the property, so only Safari applies it). **Still needed:** a real iPhone check (Safari and the installed PWA) of long-press on plain text, a link and an image. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
jared added 1 commit 2026-10-20 20:13:08 -04:00
fix(touch): harden long-press for iOS (#199)
CI / Build & Quality Checks (pull_request) Successful in 2m57s
CI / Trigger Desktop Build (pull_request) Skipped
CI / Docker image build & smoke test (pull_request) Skipped
CI / Secret scan (gitleaks) (pull_request) Successful in 8s
CI / Playwright smoke (e2e) (pull_request) Successful in 18m1s
f920fd82fb
Long-press opens the message action sheet (#166), but on iOS the system
takes a long-press for itself: the link/image callout or the text-selection
loupe races the 450 ms press. Message rows on touch screens now carry
data-touch-actions (no -webkit-touch-callout), and the pressed row carries
data-pressing from touch-down until the finger lifts, which turns text
selection off for that moment only. Copy Text stays in the sheet.

Refs #199

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
jared merged commit 7250322977 into lotus 2026-10-20 20:47:19 -04:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/cinny#440