Skip to content
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

BUG: Wrong drop target when dragging over/arround (Next.js 14 + Tailwind) #92

Open
lucarampi opened this issue Jul 19, 2024 · 6 comments

Comments

@lucarampi
Copy link

lucarampi commented Jul 19, 2024

First of all, this is me package.json file:

{
  "name": "my-app",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@atlaskit/pragmatic-drag-and-drop": "^1.2.1",
    "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^1.4.0",
    "@atlaskit/pragmatic-drag-and-drop-flourish": "^1.1.0",
    "@atlaskit/pragmatic-drag-and-drop-live-region": "^1.0.6",
    "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.1",
    "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.3",
    "class-variance-authority": "^0.7.0",
    "clsx": "^2.1.1",
    "immer": "^10.1.1",
    "lucide-react": "^0.408.0",
    "next": "14.2.5",
    "react": "^18",
    "react-dom": "^18",
    "sass": "^1.77.8",
    "tailwind-merge": "^2.4.0",
    "tailwindcss-animate": "^1.0.7",
    "tiny-invariant": "^1.3.3"
  },
  "devDependencies": {
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "eslint": "^8",
    "eslint-config-next": "14.2.5",
    "postcss": "^8",
    "tailwindcss": "^3.4.1",
    "typescript": "^5"
  }
}

I started from the tree example on the official docs: https://codesandbox.io/s/h6jq8r?module=/example.tsx

Then I did the following steps:

  1. Create Next.js project ´npx create-next-app my-app --typescript --tailwind´
  2. Copy all files of the example and reorganize some of it
  3. Removed all css props an replaced with TailwindCSS
    I did other things after this, but at this point, I was no longer working...

One thing that I noticed is that the extractInstruction() can get the write location to place the dragging element... sometimes...
In my model, I have a root element and items con only be placed inside it.
Demo: https://github.com/lucarampi/pragmatic-dnd-issues/tree/Issue%2392

The drop-indicator is going to the wrong place. If I start dragging a child with index N it applies the wrong padding to the drop-indicator -> Just created a new project and magically worked, no idea why.
Edit: About the drop-indicator, there was a "relative" in the wrong place

@lucarampi
Copy link
Author

Here is a way to bypass, but is what I was able to acchive:
image

@alexreardon
Copy link
Collaborator

Hi there,

In order to debug this issue I will need a standalone example. Could you please provide a codesandbox, stackblitz or similiar?

@lucarampi
Copy link
Author

Here is a codesandbox example.

Note: The MASTER branch is up-to-date and may differ slightly from where I started. Another branch was created for this specific issue, but it might be outdated. I recommend using the MASTER branch.

@lucarampi
Copy link
Author

Codesandbox is not working. Here is a StackBlitz one.

@lucarampi
Copy link
Author

Any updates?

@sijan67
Copy link

sijan67 commented Oct 9, 2024

Has this issue been fixed? @alexreardon
Could you elaborate in which file you placed the bypass code to resolve this? @lucarampi
I am using React + TS + Fluent UI library for my project.

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

No branches or pull requests

3 participants