Skip to content

Transform of dragged elements causes overlap of adjacent content #1644

@ohepworthbell

Description

@ohepworthbell

Problem

When a sortable element is dragged, an attribute of transform: translateZ(0) is added (looks like to fix an old rendering issue in Chrome - #1276); however, when the element is dropped this attribute is not removed, resulting in any absolutely position children of the draggable element (such as a tooltip) that extend past their parent's bounds to be overlapped by any following dragged/draggable elements.

To recreate

https://jsfiddle.net/4kcbzLse/

  1. Add 2-3 list items using button
  2. Drag a list item to the top
  3. Hover over tooltip on the right of dragged list item
  4. Observe how border of following item overlaps

Fix is very easy - just need to add a line:

css(dragEl, 'transform', '')

To line 1353 of ./src/Sortable.js (within the _onDrop: function() { ... } call). This will remove the attribute again once an element has been dropped.

Tested locally and fixes the issue for me, though to be clear - I have not experienced the issue #1276 myself, so not sure if this will cause conflicts with that. Might be worth further testing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions