Skip to content

fix: reroute file drop to Gutenberg dropzone#50

Merged
bfintal merged 2 commits into
developfrom
fix/editor-dropzone
Jun 8, 2026
Merged

fix: reroute file drop to Gutenberg dropzone#50
bfintal merged 2 commits into
developfrom
fix/editor-dropzone

Conversation

@Arukuen

@Arukuen Arukuen commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

fixes #51

Summary by CodeRabbit

Release Notes

  • New Features
    • Enhanced file drop functionality in the block editor—files can now be dropped onto additional UI controls and media management areas with improved drop zone detection.

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Arukuen, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 49 minutes and 49 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 77859a7f-dd6f-4bcb-9d70-8613d6570f93

📥 Commits

Reviewing files that changed from the base of the PR and between bd5f11d and 14871a6.

📒 Files selected for processing (1)
  • src/admin/js/media-manager/drop-zone.js
📝 Walkthrough

Walkthrough

Drop-zone file handling is enhanced to support additional block-editor UI controls and improve drop-event targeting. Three complementary changes extend where files can be dropped, refine which element receives the dispatched event, and broaden drop-zone validation to recognize custom data attributes.

Changes

Drop Zone File Targeting

Layer / File(s) Summary
Drop zone location and target dispatch
src/admin/js/media-manager/drop-zone.js
ALLOWED_LOCATIONS filter extended to .block-library-utils__media-control. Drop handler target now prefers the nearest components-drop-zone or data-is-drop-zone="true" element instead of always event.target. Drop-zone validation expanded to recognize data-is-drop-zone attribute alongside existing component and content-editor patterns.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Possibly related PRs

  • gambitph/Cimo#32: Both PRs update src/admin/js/media-manager/drop-zone.js's drop-handling logic to fix file drops not converting—one broadens accepted drop-zone targeting/conditions, while the other guards against a null .closest('.supports-drag-drop') to prevent a runtime error.

Poem

🐰 A file drops down from the sky so bright,
Now finds its zone with targeting just right—
Data attributes bloom, new controls align,
The media manager's drop zones now refine! ✨

🚥 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 'fix: reroute file drop to Gutenberg dropzone' directly describes the main change—rerouting file drops to the Gutenberg dropzone component.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/editor-dropzone

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 and usage tips.

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown

🤖 Pull request artifacts

file commit
pr50-cimo-50-merge.zip 14871a6

github-actions Bot added a commit that referenced this pull request Jun 4, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@src/admin/js/media-manager/drop-zone.js`:
- Line 158: The conditional at target?.hasAttribute('data-is-drop-zone') is
inconsistent with the earlier check that requires data-is-drop-zone==="true" and
can wrongly treat data-is-drop-zone="false" as true; update the condition in the
drop-zone detection (the combined if using target?.classList.contains and target
checks) to explicitly check the attribute value (e.g.,
target?.getAttribute('data-is-drop-zone') === 'true') instead of hasAttribute so
both branches use the same strict "true" match (referencing the same
target?.classList.contains('components-drop-zone') /
target?.getAttribute('data-is-drop-zone') === 'true' /
target?.classList.contains('uploader-editor-content') sequence).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 421c43d2-fb71-4668-b831-5f6d15864410

📥 Commits

Reviewing files that changed from the base of the PR and between a1406d4 and bd5f11d.

📒 Files selected for processing (1)
  • src/admin/js/media-manager/drop-zone.js

Comment thread src/admin/js/media-manager/drop-zone.js Outdated
github-actions Bot added a commit that referenced this pull request Jun 4, 2026
@bfintal bfintal merged commit c4a5aae into develop Jun 8, 2026
2 checks passed
@bfintal bfintal deleted the fix/editor-dropzone branch June 8, 2026 04:11
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.

Unable to upload media in the editor when drop zone is present/ Fix iteration in Smart optimization

2 participants