Reputation: 3885
JSFiddle: https://jsfiddle.net/40vpaLj5/
I googled some issues and the only disappearing related issues I found were when people used it on a modal and they talked about setting the z-index to fix it. i tried it anyway still nothing. How can I fix this?
import React from 'react';
import PlaylistPages from './PlaylistPages';
class PlaylistSortableComponent extends React.Component {
constructor(props, context) {
super(props, context);
this.state = {
test: [
'1','2', '3', '4'
]
}
}
render() {
return (
<PlaylistPages pages={this.state.test} style={{zIndex: 999999}} />
);
}
}
const PlaylistPages = SortableContainer(({pages}) => {
return (
<div>
{
pages.map((page, index) =>
<PlaylistPage key={index} page={page} style={{zIndex: 99999999}} />
)}
</div>
);
});
const PlaylistPage = SortableElement(({page}) => {
return (
<div style={{zIndex: 99999999}} >{page}</div>
);
});
Upvotes: 3
Views: 5749
Reputation: 92
After setting the zIndex value. It has worked.MUI dialog has the zIndex of about 1300 so above it will work.
dragged: {
zIndex: 999999,
boxShadow:
"0px 6px 6px -3px rgba(0, 0, 0, 0.2), 0px 10px 14px 1px rgba(0, 0, 0, 0.14), 0px 4px 18px 3px rgba(0, 0, 0, 0.12)",
"& button": {
opacity: 50
}
}
Upvotes: 0
Reputation: 131
I had the same issue and Dekel is right. In my case the z-index fix the error:
<SortableList
axis="y"
helperClass="sortable-list-tab"
lockAxis="y"
distance={0}
onSortEnd={onSortEnd}
>
<ul>
{toolItems.map((value, index) => (
<SortableItem key={`item-${index}`} index={index}>
<li className="sortable-list-tab" >
<Button type="dashed">{`${value.label} (${index + 1})`}</Button>
</li>
</SortableItem>
))}
</ul>
</SortableList>
And the sortable-list-tab class look like:
.sortable-list-tab {
cursor: default;
visibility: visible;
z-index: 99999999;
list-style-type: none;
padding: .3em;
}
Upvotes: 2
Reputation: 62566
Every sortableElement
should have it's own index
prop:
<PlaylistPage key={index} index={index} page={page} style={{zIndex: 99999999}} />
Here is the update to your jsfiddle:
https://jsfiddle.net/40vpaLj5/1/
Upvotes: 10