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

Width of items with padding/border changes #67

Closed
Philipp91 opened this issue Oct 10, 2016 · 1 comment
Closed

Width of items with padding/border changes #67

Philipp91 opened this issue Oct 10, 2016 · 1 comment

Comments

@Philipp91
Copy link

Because react-sortable-hoc uses offsetWidth (see

this.width = node.offsetWidth;
), which includes borders and paddings (see https://developer.mozilla.org/de/docs/Web/API/HTMLElement/offsetWidth), as the width of the helper, it is too wide. This results in visual "jump" when dragging items.

Possible solutions:

  • always set "box-sizing: border-box" on the helper
  • use clientWidth instead.

Workaround:

  • set "box-sizing: border-box" on your SortableElements manually.
@clauderic
Copy link
Owner

Both clientWidth and offsetWidth include padding, so I opted for the forced box-sizing: border-box on the helper approach. Thanks!

DimitarNestorov pushed a commit to codemotionapps/react-sortable-hoc that referenced this issue Feb 4, 2019
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