Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions packages/ui/components/Viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,21 @@ export const Viewer = forwardRef<ViewerHandle, ViewerProps>(({
onCodeBlockClick: handlePinpointCodeBlockClick,
});

// Suppress native context menu on touch devices (prevents cut/copy/paste overlay on mobile)
useEffect(() => {
const container = containerRef.current;
if (!container) return;
const isTouchPrimary = window.matchMedia('(pointer: coarse)').matches;
if (!isTouchPrimary) return;

const handleContextMenu = (e: Event) => {
e.preventDefault();
};

container.addEventListener('contextmenu', handleContextMenu);
return () => container.removeEventListener('contextmenu', handleContextMenu);
}, []);

// Detect when sticky action bar is "stuck" to show card background
useEffect(() => {
if (!stickyActions || !stickySentinelRef.current) return;
Expand Down Expand Up @@ -923,6 +938,7 @@ export const Viewer = forwardRef<ViewerHandle, ViewerProps>(({
className={`w-full bg-card rounded-xl shadow-xl p-5 md:p-8 lg:p-10 xl:p-12 relative ${
linkedDocInfo ? 'border-2 border-primary' : 'border border-border/50'
} ${inputMethod === 'pinpoint' ? 'cursor-crosshair' : ''}`}
style={{ WebkitTouchCallout: 'none' } as React.CSSProperties}
>
{/* Repo info + plan diff badge + demo badge + linked doc badge - top left */}
{(repoInfo || hasPreviousVersion || showDemoBadge || linkedDocInfo) && (
Expand Down
Loading