Skip to content

fix(richtext-lexical): drag/drop image into rich text fails when a field name matches the collection slug#16409

Merged
GermanJablo merged 2 commits intopayloadcms:3.xfrom
GermanJablo:cursor/6a987709-3x
Apr 29, 2026
Merged

fix(richtext-lexical): drag/drop image into rich text fails when a field name matches the collection slug#16409
GermanJablo merged 2 commits intopayloadcms:3.xfrom
GermanJablo:cursor/6a987709-3x

Conversation

@GermanJablo
Copy link
Copy Markdown
Contributor

Summary

Backport of #16397 to 3.x.

When a top-level rich text field has the same name as the collection's slug, dragging or pasting an image into the editor opens a blank bulk upload drawer. The lexical field and the document layout both mount a BulkUploadProvider; when the field path equals the collection slug they compute the same drawer slug and render two drawers for it, one with empty state (blank), which is what the user sees.

The fix is a 1-line change: namespace the lexical field's nested BulkUploadProvider with a lexical- prefix so its drawer slug can never collide with the document-level provider.

- <BulkUploadProvider drawerSlugPrefix={path}>
+ <BulkUploadProvider drawerSlugPrefix={`lexical-${path}`}>

The rest of the diff is a new e2e test.

Test plan

Added test/lexical/collections/LexicalSlugFieldNameCollision/e2e.spec.ts, which asserts that dropping a file into a rich text editor opens exactly one bulk upload drawer when the field name equals the collection slug. Verified that the test fails without the production change (Expected: 1, Received: 2) and passes with it.

@GermanJablo GermanJablo merged commit d6f7b47 into payloadcms:3.x Apr 29, 2026
332 of 336 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants