Skip to content

Fix Kanban drag-and-drop only registering drops near top of column#19061

Closed
jnMetaCode wants to merge 1 commit intotwentyhq:mainfrom
jnMetaCode:fix/kanban-drag-drop-18842
Closed

Fix Kanban drag-and-drop only registering drops near top of column#19061
jnMetaCode wants to merge 1 commit intotwentyhq:mainfrom
jnMetaCode:fix/kanban-drag-drop-18842

Conversation

@jnMetaCode
Copy link
Copy Markdown

Summary

  • Moves droppableProvided.placeholder back inside the innerRef container (StyledColumnCardsContainer) to fix broken drag-and-drop in Kanban view
  • The placeholder was moved outside the innerRef element in PR Improved Kanban performance #15714 as part of a performance optimization, which violated @hello-pangea/dnd's API contract requiring the placeholder to be rendered inside the same DOM node that receives innerRef
  • This caused the library's hit detection to use a shrunk bounding box, so drops only registered near the top of target columns

Root Cause

@hello-pangea/dnd requires droppableProvided.placeholder to be rendered inside the same DOM element that receives droppableProvided.innerRef. In the current code, innerRef is on StyledColumnCardsContainer inside RecordBoardColumnCardsContainer, but the placeholder was rendered as a sibling in the parent RecordBoardColumn. This caused the droppable area to shrink when a card was dragged out, making drops only register near the top.

Changes

  • RecordBoardColumnCardsContainer.tsx: Added droppableProvided.placeholder inside the StyledColumnCardsContainer (the innerRef element)
  • RecordBoardColumn.tsx: Removed the placeholder from outside the DragAndDropLibraryLegacyReRenderBreaker wrapper

Test plan

  • Open a Kanban view with enough cards that at least one column requires scrolling
  • Drag a card from one column and drop it into the middle of another column — should work
  • Drag a card and drop it into the bottom of another column — should work
  • Drag a card and drop it at the top of a column — should still work
  • Verify no regressions in card ordering after drop

Fixes #18842

Move droppableProvided.placeholder back inside the innerRef container
(StyledColumnCardsContainer) to satisfy @hello-pangea/dnd's API contract.

The placeholder was moved outside the innerRef element in PR twentyhq#15714 as
part of a performance optimization, which broke the library's hit
detection for drop zones. This caused drops to only register near the
top of target columns.

Fixes twentyhq#18842
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

@github-actions
Copy link
Copy Markdown
Contributor

Welcome!

Hello there, congrats on your first PR! We're excited to have you contributing to this project.
By submitting your Pull Request, you acknowledge that you agree with the terms of our Contributor License Agreement.

Generated by 🚫 dangerJS against 9f38455

@charlesBochet
Copy link
Copy Markdown
Member

@jnMetaCode Please stop opening AI generated PR on this repository. You are not helping us and harming the community. This will be the only warning before ban: one more and that's it

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.

Kanban drag-and-drop only registers drops near the top of a column

2 participants