fix: open image previews from touchend so iOS taps don't raise the keyboard#263
Merged
Merged
Conversation
…yboard Preventing pointerdown (prosekit#253) suppresses the compatibility mouse events, but iOS WebKit's tap-to-focus is a native gesture default action: tapping an image preview still focuses the surrounding contenteditable and briefly raises the software keyboard before the click handler opens its surface (e.g. a lightbox). Only cancelling the tap's touchend stops it — which also suppresses the synthetic click, so the image click handler now tracks single-finger taps on previews itself (movement tolerance, resize-handle and multi-touch exclusions) and fires onClick from touchend. ImageClickPayload.event widens to MouseEvent | TouchEvent accordingly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
@maccman is attempting to deploy a commit to the ocavue's projects Team on Vercel. A member of the Team first needs to authorize it. |
commit: |
Desktop WebKit exposes the Touch interface but its constructor throws
("Illegal constructor"); the tap logic stays covered by chromium and
firefox.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
maccman
added a commit
to team-reflect/reflect-open
that referenced
this pull request
Jul 8, 2026
prosekit/meowdown#263 landed as 89aa7e7 and shipped in 0.40.0 (0.40.1 is the latest patch). Bumping the pinned range since ^0.39.0 does not resolve past 0.39.x for a 0.x package. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
#253 prevented
pointerdownon image previews so a touch tap wouldn't focus the editor. That suppresses the compatibility mouse events, but on iOS WebKit tap-to-focus is a native gesture default action tied to the touch event stream: tapping an image preview still focuses the surrounding contenteditable and briefly raises the software keyboard, right as the click handler opens its own surface (e.g. a lightbox) — a visible keyboard show/hide flash on every image tap.Fix
The only thing that stops WebKit's synthetic-click/focus path is cancelling the tap's
touchend. That also suppresses the syntheticclick, sodefineImageClickHandlernow recognizes taps itself:touchstartrecords a single-finger touch on a preview (touches on the resize handle are excluded — they start a resize, never a tap)touchmovepast a 10px tolerance invalidates it (scroll/drag)touchendon a still-valid tap callspreventDefault()and firesonClickdirectlyMouse clicks keep going through
handleClickunchanged, and the #253pointerdownguard stays for non-WebKit touch surfaces.ImageClickPayload.eventwidens toMouseEvent | TouchEventsince the touch path hands the handler the originatingtouchend.Testing
onClickonce with the touchend cancelled; a moved touch is ignored and left uncancelled; a tap on the resize handle is left alone.pnpm exec vitest run --project @meowdown/core image— 27/27 pass.pnpm typecheckclean; changed files lint clean.🤖 Generated with Claude Code