clauderic / clauderic/react-sortable-hoc

run getHelperDimensions after shouldCancelStart

Open
#329 1 comment 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
10.9k
Forks
959
PR merge metrics
No merged PRs in 30d

Description

Right now I developing app with expanded panels.
So on sorting start (when starting dragging drag handler) - I need to collapse all panels and start sort.

I'm using _shouldCancelStart_ as "beforeStart" - to execute code that collapses my panels before sorting started (if i use _onSortStart_ instead of _shouldCancelStart_ - then sortingHelper is looks like expanded panel).

And problem is that _getHelperDimensions_ is triggering before _shouldCancelStart_ .
So it sets width and height of expanded panel for sortingHelper.

Right now I manually setting height and width for helper using _getHelperDimensions_ (height of collapsed panel is static so it's easy for me to hardcode it).
```
({
width: node.offsetWidth,
height: 48,
})}
lockAxis="y"
shouldCancelStart={this.collapseAll}
onSortEnd={(sortData) => { this.onSortEnd(sortData, activeTab, data); }}
/>
```

OK would be if _getHelperDimensions_ would run after _shouldCancelStart_ or _onSortStart_.
Great would be to have something like "beforeSortStart".

Also if _userDragHandle_ is true - _shouldCancelStart_ should be triggered only when dragHandler is clicked/moved (right now from what I understand _shouldCancelStart_ fires always when you click sortableItem , even if you're not clickng dragHandler and it's enabled)



Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.