jasonslyvia / jasonslyvia/react-anything-sortable

direction="vertical" on <Sortable> not working and <Sortable> in overflow:scroll buggy?

Open
#55 10 comments 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
JavaScript
Stars
457
Forks
82
PR merge metrics
No merged PRs in 30d

Description

Hi Jason,

The direction="vertical" on my code doesn't seem to work in my code. However containment: true works, the only bug is when the parent container has a overflow: scroll.

Here's a simplified test case of how I'm implementing my code and also an "almost" carbon-copy code of your "vertical" demo.

App.js

``` javascript
import React from 'react';
import Sortable from 'react-anything-sortable';
import { sortable } from 'react-anything-sortable';

@sortable
class WidgetListItem extends React.Component {
render() {
return (


{this.props.children}

)
}
}

export default class WidgetList extends React.Component {
constructor() {
super();
this.state = {};
}

handleSort(data) {
this.setState({
result: data.join(' ')
});
}

toggleCheckbox(evt) {
console.log(evt)
}

render() {
let items = [1,2,3,4,5,6,7,8,9,10]
// TODO: move widget creation to its own component
const widgetItems = items.map(i => {
return (

Widget {i}

)
})
return


React Sortable Test



{widgetItems}


}
}
```

``` css
/* pre-built style */
.ui-sortable {
display: block;
position: relative;
overflow: visible;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}

.ui-sortable:before,
.ui-sortable:after{
content: " ";
display: table;
}

.ui-sortable:after{
clear: both;
}

.ui-sortable .ui-sortable-item {
float: left;
cursor: move;
}

.ui-sortable .ui-sortable-item.ui-sortable-dragging {
position: absolute;
z-index: 1688;
}

.ui-sortable .ui-sortable-placeholder {
display: none;
}

.ui-sortable .ui-sortable-placeholder.visible {
display: block;
z-index: -1;
}

/*custom*/
.vertical-container {
width: 200px;
padding: 10px;
border: 1px #ccc solid;

height:150px;
overflow: scroll;
}

.vertical.ui-sortable-item {
float: none;
display: block;
width: 100%;
padding: 10px 5px;
margin-bottom: 10px;
border: 1px #eee solid;
}
```

It's weird that the direction="vertical" works for on your GitHub demo, but not on mine (maybe only doesn't work for me?)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the reproduction in App.js and its custom CSS, especially .vertical-container overflow: scroll and the vertical sortable item rules. Compare this behavior with the repository's vertical demo and determine whether direction="vertical" or scrolling causes the failure. Done means vertical sorting works in the supplied example, including inside the scrolling container, with the reported result still updating.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.