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

2.1.2 GridItem className not set #30

Open
rsmarsh opened this issue Dec 15, 2020 · 1 comment
Open

2.1.2 GridItem className not set #30

rsmarsh opened this issue Dec 15, 2020 · 1 comment

Comments

@rsmarsh
Copy link

rsmarsh commented Dec 15, 2020

In 2.1.2 the className which is added to each GridItem, along with 'dragging' or 'disabled' is no longer functioning due to a jumbled ternary

This can be seen by taking the codesandbox demo from this repo's README, and bumping the react-grid-dnd version number up to 2.1.2, then inspect the div element wrapping each grid item (as seen here). You will see that the div now has a className of 'undefined', and when dragging, the 'dragging' class is not appended
image

I have created a pull request #28 with an example fix for this.

@loocuu
Copy link

loocuu commented Apr 11, 2022

Issue is still present, easy to fix
you need to add parenthesis because className conditional statement clears out content that is added before it.
GridItem.tsx line 143

className:
      "GridItem" +
      (isDragging ? " dragging" : "") +
      (!!disableDrag ? " disabled" : "") +
      (className
        ? ` ${className}`
        : ""),

I can create PR

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

No branches or pull requests

2 participants