-
Notifications
You must be signed in to change notification settings - Fork 440
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
Not All Scroll Events are Heard by $document #67
Comments
I get an application error on the link you provided. I am on the fence with this one. Making this plugin work with every kind of scrolling scenario is impossible and i want to keep this out as much as possible. Therefore autoscroll will never be part of this plugin. I had once pondered the idea of passing a scrollable element as an option, but scraped it again. It was an option too specialized. I do like the idea of looking at the parents though. I will investigate this |
Hmm it looks like bl.ocks.org is down. Here is the source https://gist.github.com/HandyAndyShortStack/9005218 |
I was about to formulate a pull request when I realized that my solution in commit fce46da would not work for some situations involving two or more grouped sortable lists. If you begin dragging an item from a sortable list and then scroll a parent of an item in a separate list that is not a parent of the first list, you will encounter the same behavior as I described in the initial issue description. In order to remedy this, I need to look at the parents of every item of every container in the group. I can make the process somewhat more efficient by stopping the search up the parent chain at the containter element and searching up from the container element only once per container. If items are nested I do not see a way of avoiding checking the parent chain between the nest parent and the container element more than once, but this should not cause significant performance issues. I have amended commit fce46da to remove the portion of the commit description indicating that it resolves this issue and am working on a solution that solves the cases described in the preceding paragraph. You can see my fix for parents of the dragged element working here: |
Okay, @aatrostle and I have put together a demo of the problem with my first fix attempt: |
Great, thanks for taking this in your hands and for providing so many The problems you described seem vaguely familiar. I am very interested in On Fri, Feb 28, 2014 at 6:30 PM, Andy Short [email protected]:
|
I have implemented a possible solution to the issue in this commit: |
Thank you again for working this and please excuse my long silence. I struggle to find the time to work on oss projects atm. I looked at your code and I have several suggestions.
And finally, I have a question: Please open a pull request, even if you have not addressed any of the above points. A pull request is easier to discuss and directly shows the complete diff. |
Thanks for the feedback. I will open a pull request incorporating the suggested changes as soon as I have time. In regard to your question, It does seem that there can be scrollable elements between items and their containers in nested situations. I may be misreading the library though. I will endeavor to produce an example of such a situation. |
Any progress on this? It'd be great to get this fix merged into a release! |
I was having an issue yesterday when using this library for sorting a group of lists inside a scrollable div. If I began to drag a list item and scrolled the div during the drag, I found that the placeholder would no longer follow my mouse position correctly. It seemed to be tracking a point directly above or below my pointer by the same distance that I had scrolled. Here is an example of what I experienced: http://bl.ocks.org/handyandyshortstack/raw/9005218/.
Upon further investigation, I found this was because the
ContainerGroup
was not recalculating container and offset metrics in response to these scroll events. It seems that scroll events inside scrollable elements never reach the document, soContainerGroup.prototype.scroll
is not called when they are fired.I patched up my copy of jquery-sortable by placing the following line at the end of
ContainerGroup.prototype.toggleListeners
(my copy is based on v0.9.11):I am already passing in a namespaced jQuery object at the end of the file so one more minor modification is no big deal, but I really think this issue should be dealt with more properly. I am not sure how best to go about it though. Perhaps an additional group default could be exposed where users could pass in additional elements or selectors on which to attach event listeners while dragging. It also might be feasable to look explicitly for css indicating scrollability recursively on the parents of sortable elements and attach listeners to those if they are found.
The text was updated successfully, but these errors were encountered: