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

Margins and keyboard dragging #201

Closed
alexreardon opened this issue Nov 27, 2017 · 4 comments
Closed

Margins and keyboard dragging #201

alexreardon opened this issue Nov 27, 2017 · 4 comments

Comments

@alexreardon
Copy link
Collaborator

Currently the keyboard dragging is a little bit off visually if you rely on a margin other than margin-bottom. This has to do with margin-collapsing behavior and edge alignment. I did a small spike with promising results.

Work arounds

  • use margin-bottom for pushing Draggable's apart
  • use padding for pushing Draggables apart
  • wrap your element within the Draggable inside another and then use padding to push them apart. Something like this:
render() {
    const { quote, provided } = this.props;

    const style = {
      ...provided.draggableStyle,
      padding: 10,
    };

    return (
      <div style={style} ref={provided.innerRef}>
        <div {...provided.dragHandleProps}>
           <div>Hello world!</div>
        </div>
      </div>
    );
  }
@matthax
Copy link

matthax commented Oct 23, 2018

Fiddled around with trying to customize the placeholder to resolve this issue but ended up taking the padding approach. The workaround solved the issue but it would be nice to see if there's more that could be done here.

Worth noting, my attempt was with reactstrap form groups which do specify a margin-bottom as part of their class styles and setting marginBottom through react style props did not solve the issue either. I'm going to play around a little more but in the meantime thanks for the solution.

@alexreardon
Copy link
Collaborator Author

Good news, this will be fixed in version 10 #838

@alexreardon
Copy link
Collaborator Author

try using react-beautiful-dnd-next and let me know if your issue remains @matthax

@alexreardon
Copy link
Collaborator Author

Closed by #838. See version 10 release notes

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

2 participants