Skip to content

Studio: open the tile's own menu on a right-click in the Images strip - #15276

Merged
danielhanchen merged 4 commits into
unslothai:mainfrom
debojyoti-dev:fix/images-strip-right-click-menu
Oct 26, 2026
Merged

danielhanchen merged 4 commits into
unslothai:mainfrom
debojyoti-dev:fix/images-strip-right-click-menu

Conversation

@debojyoti-dev

@debojyoti-dev debojyoti-dev commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #15272

Before: right-clicking a thumbnail in the Images strip showed the webview's native image menu (Open Image in New Window, Save Image As, Copy Image, Copy Image Address). The thumbnails are blob: object URLs, and inside the desktop app Open Image in New Window and Copy Image do nothing with them, so the menu offered actions that silently failed.

After: right-clicking a strip tile opens that tile's own actions menu (Edit image, Pin, Add to Favorites, Download, Project, Archive, Delete), the same menu the tile's hover button opens, anchored at the tile. The native menu no longer appears there. The keyboard context-menu key and Shift+F10 open it too, since they fire the same event.

How: the tile wrapper handles contextmenu, calls preventDefault(), and records which tile asked. GalleryItemMenu takes optional open / onOpenChange props so the page can open it; when they are omitted it keeps its own state as before, so the Video, Audio and toolbar uses are unchanged. The request is dropped when the page goes off-tab or the tile is removed, in the same render-time way the viewer's viewerId already is, so a stale request cannot reopen the menu later.

Copy Image is not added to the menu: the desktop app can't write images to the clipboard today (see canCopyVideoFrame in features/browser/video-registry.ts), so offering it would repeat the bug. Download covers saving the file.

Testing

  • New tests/images-strip-context-menu.test.ts (fails on main, passes here).
  • Full frontend suite: 13953 tests, 13942 pass, 0 fail, 11 skipped.
  • npm run typecheck passes. ESLint on the two changed files reports the same findings as on main and nothing new.
  • Playwright against the Vite dev server with mocked gallery APIs: a right-click on a strip tile fires contextmenu with defaultPrevented === true and opens that tile's menu; Escape closes it; right-clicking another tile while it is open moves the menu to that tile; the hover button still opens the menu. On main the same script finds no menu.

I tested on Windows in Chromium. I don't have Fedora or a WebKitGTK build of the desktop app here, so I couldn't try the native menu suppression in that webview directly; it relies on the standard preventDefault() on contextmenu, which WebKitGTK honours.

Desktop only

The right-click handler only acts inside the desktop app (isTauri). In a browser the native image menu works on these thumbnails (Copy Image, Open Image in New Tab, Save Image As), so browser Studio keeps it unchanged. Both the tile menu and the hover button are otherwise identical everywhere.

Screenshots

Right-click on the first strip tile, production build of Studio, menu code as in this PR. The desktop webview cannot be driven here, so the shot is from Chromium with the desktop gate off; inside the desktop app the AFTER menu is what a right-click opens, and in a browser the BEFORE behaviour is kept.

Images strip right-click, before and after

A right-click on a strip thumbnail showed the webview's native image menu.
Its Open Image in New Window and Copy Image items cannot act on the strip's
blob: object URLs inside the desktop app, so they silently did nothing.

The tile now cancels the native menu and opens its existing actions menu
(Edit image, Pin, Favorites, Download, Project, Archive, Delete), the same
one its hover button opens. GalleryItemMenu gains optional open and
onOpenChange props for this; callers that pass neither are unchanged.

Fixes unslothai#15272
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-26T05:28:24.694548Z
We couldn’t complete this review. Comment @codex review to try again.
840da06 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 26, 2026
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] "Open image in new window" and "Copy image" context menu items from the Edit gallery strip do nothing

2 participants