Fix missing native image context menu in media modal - #1575
Merged
Conversation
react-zoom-pan-pinch unconditionally sets pointer-events: none on images inside its TransformComponent (baked into its bundled CSS, no config to opt out), so right-clicking an image in the media modal targets the wrapper div instead of the img — the browser never offers Copy Image / Save Image As. Re-enable pointer events via inline style on the modal image, and set draggable=false so native image dragging — what the library rule was guarding against — stays off. Pan and double-click zoom still work since pointer events bubble to the wrapper.
Owner
|
Question, in case if you remember, was this working before the |
Contributor
Author
|
Yes — this is a regression from that migration. |
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.
Right-clicking an image in the full-screen media modal shows the browser's generic page context menu (Back / Reload / Save Page As…) instead of the image context menu — Copy Image, Copy Image Link and Save Image As… are unavailable.
Root cause
react-zoom-pan-pinch, which powers pinch-zoom in the modal, ships this rule in its bundled stylesheet:so the
<img>insideTransformComponentcan never be a hit-test target. Right-clicks land on thereact-transform-componentwrapper div, and the browser has no image element to build the image context menu for. Verified on dev.phanpy.social (2026.07.20.57870e3):document.elementFromPoint()at the image's center returns the wrapper div, and the img's computedpointer-eventsisnone.Fix
Set inline
pointerEvents: 'auto'anddraggable={false}on the modal<img>insrc/components/media.jsx.The inline style overrides the library's stylesheet, and
draggable={false}keeps native image dragging off — which is what the library rule was guarding against, since a drag ghost would interfere with panning.Verified
<img>→ native image context menu with Copy Image etc.Notes
en.poreference shift regenerated from themedia.jsxedit.-webkit-touch-callout: noneon its wrapper. Left out of scope here — desktop right-click is the common case — but could be a follow-up.