-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not allow dropping text on the columns #3353
Conversation
@@ -201,7 +206,7 @@ export default function HeaderCell<R, SR>({ | |||
} | |||
|
|||
function onDragStart(event: React.DragEvent<HTMLDivElement>) { | |||
event.dataTransfer.setData('text/plain', column.key); | |||
event.dataTransfer.setData(dragDropKey, column.key); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/HeaderCell.tsx
Outdated
@@ -51,6 +53,8 @@ const cellOver = css` | |||
|
|||
const cellOverClassname = `rdg-cell-drag-over ${cellOver}`; | |||
|
|||
const dragDropKey = 'column-key'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably make this unique for each grid instance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using useId
to generate uniqueKey for each grid
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3353 +/- ##
=======================================
Coverage ? 82.98%
=======================================
Files ? 47
Lines ? 5071
Branches ? 789
=======================================
Hits ? 4208
Misses ? 863
Partials ? 0
|
if (event.dataTransfer.types.includes(dragDropKey)) { | ||
const sourceKey = event.dataTransfer.getData(dragDropKey); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Do not allow dropping text on the columns * Fix test * Use `useId` to generate unique key
Fixes #3349