Skip to content

fix: open file picker when Browse files is clicked in Dropper (#1261)#1395

Closed
kairavb wants to merge 2 commits into
rocketride-org:developfrom
kairavb:fix/RR-1261-browse-files-button
Closed

fix: open file picker when Browse files is clicked in Dropper (#1261)#1395
kairavb wants to merge 2 commits into
rocketride-org:developfrom
kairavb:fix/RR-1261-browse-files-button

Conversation

@kairavb

@kairavb kairavb commented Jul 1, 2026

Copy link
Copy Markdown

Browse files stopped propagation and called onBrowse(), which is a no-op outside a wired VS Code host. Use openFilePicker() instead so the button matches click-to-upload on the drop zone.

Summary

  • Browse files in DropZone called onBrowse()
  • which is a no-op in iframe/VS Code contexts.
  • It now calls openFilePicker() so the button opens the same native file picker as clicking the drop zone.

Type

  • Bug fix

Testing

  • Reproduced via iframe test (/tmp/dropper-iframe.html), Browse files now opens picker
  • Clicking drop zone still opens picker (no double-fire)
  • ./builder dropper-ui:build --force passes

Checklist

  • PR targets develop
  • Linked to an issue
  • Conventional commit message

Linked Issue

Fixes #1261

Summary by CodeRabbit

  • Bug Fixes
    • Fixed the “Browse files” button so it now opens the file picker reliably when clicked.
    • Updated the drag-and-drop area to render the “Browse files” button only when enabled by configuration.

Browse files stopped propagation and called onBrowse(), which is a
no-op outside a wired VS Code host. Use openFilePicker() instead so
the button matches click-to-upload on the drop zone.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot added the module:ui Chat UI and Dropper UI label Jul 1, 2026
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor
🤖 Internal: Discord sync marker

Auto-managed by the Discord notification workflow. Stores the linked Discord message ID. Do not edit or delete.

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The browse button now renders from a boolean prop and opens the internal file picker directly. The container no longer passes a native-dialog callback and instead controls browse-button visibility with a parent-window check.

Changes

Dropper browse button flow

Layer / File(s) Summary
DropZone browse control
apps/dropper-ui/src/components/DropZone.tsx
DropZoneProps now uses showBrowseButton; the button render state and label follow that flag, and the click handler stops propagation then calls openFilePicker().
Container browse wiring
apps/dropper-ui/src/components/DropperContainer.tsx
DropperContainer removes the VS Code dialog callback path and passes showBrowseButton={window.parent !== window} into DropZone.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: jmaionchi, stepmikhaylov, Rod-Christensen

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly states the user-facing fix: clicking Browse files now opens the file picker.
Linked Issues check ✅ Passed The change makes the Browse files button call openFilePicker while still stopping propagation, matching #1261's expected behavior.
Out of Scope Changes check ✅ Passed The DropperContainer refactor stays within the same fix and wiring cleanup, with no unrelated feature changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: dependency version conflict. Check your lock file or package.json.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/dropper-ui/src/components/DropZone.tsx (1)

162-170: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Preserve the onBrowse native-dialog path for this button
The button is only shown when onBrowse is provided for the VS Code/Cursor webview case, but it now always calls openFilePicker(). That makes the requestFileDialog fallback unreachable from the browse button; use onBrowse() when present and fall back to openFilePicker() otherwise.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/dropper-ui/src/components/DropZone.tsx` around lines 162 - 170, The
Browse files button in DropZone.tsx currently always calls openFilePicker(),
which bypasses the native-dialog path exposed by onBrowse. Update the button’s
onClick handler in the browse button render block to call onBrowse() when that
prop is available and only fall back to openFilePicker() otherwise, so the VS
Code/Cursor webview flow still uses requestFileDialog through onBrowse.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@apps/dropper-ui/src/components/DropZone.tsx`:
- Around line 162-170: The Browse files button in DropZone.tsx currently always
calls openFilePicker(), which bypasses the native-dialog path exposed by
onBrowse. Update the button’s onClick handler in the browse button render block
to call onBrowse() when that prop is available and only fall back to
openFilePicker() otherwise, so the VS Code/Cursor webview flow still uses
requestFileDialog through onBrowse.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: f90714c3-2d68-47a6-a3d6-68d8047ca4ac

📥 Commits

Reviewing files that changed from the base of the PR and between 1c81d69 and bb5a215.

📒 Files selected for processing (1)
  • apps/dropper-ui/src/components/DropZone.tsx

@kwit75

kwit75 commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Heads-up: this overlaps with #1377 and #1235 — all three wire the Browse-files button to the native file dialog. We should pick one and close the other two to avoid a triple-merge. Flagging for a maintainer call.

@kairavb kairavb changed the title fix: open file picker when Browse files is clicked in Dropper fix: open file picker when Browse files is clicked in Dropper (#1261) Jul 2, 2026

@dsapandora dsapandora left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice small, surgical fix — exactly the kind of one-liner that's easy to review and easy to trust given the manual iframe repro you did.

Swapping onBrowse() for openFilePicker() on the Browse files button makes sense given the bug: onBrowse was presumably meant as a host-callback hook that's a no-op unless something's wired up outside the webview, so routing through the same openFilePicker() used by the drop zone click is the right fix and keeps both entry points consistent.

One thing worth a quick check before merging: is onBrowse (and the DropZoneProps.onBrowse prop) still used anywhere else in this component or by callers? If this was its only call site, it's now dead code and worth either removing the prop or leaving a note on why it's kept around (e.g. for a future host integration). Not a blocker, just don't want an unused prop/lint warning to sneak in.

Replace the onBrowse prop with showBrowseButton now that Browse files
uses openFilePicker(). Drop the unused VS Code native dialog helper.

Co-authored-by: Cursor <cursoragent@cursor.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/dropper-ui/src/components/DropperContainer.tsx (1)

253-254: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove the orphaned nativeFilesSelected listener
DropperContainer.tsx still listens for window.parent messages of type nativeFilesSelected, but the removed requestNativeFileDialog path was the only sender from this component. With no in-repo emitter for that message, the effect is dead code and should be removed with the rest of the browse-dialog cleanup.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/dropper-ui/src/components/DropperContainer.tsx` around lines 253 - 254,
The `DropperContainer` message listener still handles `nativeFilesSelected` even
though the related `requestNativeFileDialog` flow was removed, so this effect is
now dead code. Remove the orphaned `window.parent` message handling from
`DropperContainer.tsx`, including any `useEffect`/handler logic and cleanup tied
to `nativeFilesSelected`, and keep only the remaining browse-dialog behavior
that is still referenced by this component.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@apps/dropper-ui/src/components/DropperContainer.tsx`:
- Around line 253-254: The `DropperContainer` message listener still handles
`nativeFilesSelected` even though the related `requestNativeFileDialog` flow was
removed, so this effect is now dead code. Remove the orphaned `window.parent`
message handling from `DropperContainer.tsx`, including any `useEffect`/handler
logic and cleanup tied to `nativeFilesSelected`, and keep only the remaining
browse-dialog behavior that is still referenced by this component.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3c74470b-7932-4a6d-928e-56f57e18cde1

📥 Commits

Reviewing files that changed from the base of the PR and between bb5a215 and e72d267.

📒 Files selected for processing (2)
  • apps/dropper-ui/src/components/DropZone.tsx
  • apps/dropper-ui/src/components/DropperContainer.tsx

@kairavb

kairavb commented Jul 2, 2026

Copy link
Copy Markdown
Author

Addressed (grep -R "onBrowse" returns no matches or any search) — onBrowse was no longer called after switching the button to openFilePicker(). Replaced it with a showBrowseButton flag and removed the unused VS Code native-dialog helper.

@charliegillet

Copy link
Copy Markdown
Collaborator

Thanks for investigating the Dropper Browse-files behavior, @kairavb. The underlying issue is now addressed by merged PR #1235, which provides the native file-dialog round trip used by the embedded VS Code flow. This PR would replace that callback path and risk regressing uploads, so it should be closed as superseded with your contribution credited.

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

Labels

module:ui Chat UI and Dropper UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dropper node: "Browse files" button does not open file picker when clicked directly

4 participants