fix: prevent image preview focus on touch pointerdown#253
Merged
ocavue merged 2 commits intoJul 7, 2026
Conversation
|
@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: |
ocavue
approved these changes
Jul 7, 2026
Merged
maccman
added a commit
to maccman/meowdown
that referenced
this pull request
Jul 8, 2026
…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>
This was referenced Jul 8, 2026
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
Clickable image previews live inside the editor contenteditable. On touch surfaces, tapping a rendered image can let the browser focus the editor on pointerdown before the image click handler opens an external surface such as a lightbox. In mobile WebKit this can briefly raise the software keyboard.
Changes
defineImageClickHandler.pointerdownDOM event handler for clickable image previews that callspreventDefault()for non-mouse pointers.falsefrom the DOM handler so the event is not swallowed and the existing click handler still receives the click.Verification
pnpm exec vitest run packages/core/src/extensions/image.test.tspassed: 24 tests.pnpm typecheckpassed.pnpm lintpassed.