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

fixing a bug where dragging.style.display was not restored on dragend #777

Merged
merged 1 commit into from
Jun 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/html5sortable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,10 @@ export default function sortable (sortableElements, options: configuration|objec
if (dragging.getAttribute('aria-copied') === 'true' && data(dragging, 'dropped') !== 'true') {
dragging.remove()
}

if (dragging.oldDisplay !== undefined) {
dragging.style.display = dragging.oldDisplay
delete dragging.oldDisplay
}
const visiblePlaceholder = Array.from(stores.values()).map(data => data.placeholder)
.filter(placeholder => placeholder instanceof HTMLElement)
.filter(isInDom)[0]
Expand Down Expand Up @@ -475,8 +478,10 @@ export default function sortable (sortableElements, options: configuration|objec
if (visiblePlaceholder) {
visiblePlaceholder.replaceWith(dragging)
// to avoid flickering restoring element display immediately after replacing placeholder
dragging.style.display = dragging.oldDisplay
delete dragging.oldDisplay
if (dragging.oldDisplay !== undefined) {
dragging.style.display = dragging.oldDisplay
delete dragging.oldDisplay
}
} else {
// set the dropped value to 'false' to delete copied dragging at the time of 'dragend'
data(dragging, 'dropped', 'false')
Expand Down