Opened 5 years ago

Last modified 5 years ago

#9460 open bug

Sortable: containment doesn't work properly when scrolling

Reported by: omegak Owned by:
Priority: minor Milestone: none
Component: ui.sortable Version: 1.10.3
Keywords: Cc:
Blocked by: Blocking:

Description

In a sortable component, the containment works just fine when the container (overflow: auto) is not scrolling. However, when it does, if an item is dragged to the bottom the containment stops working as expected. The item moves then beyond the height of the container until its scrollHeight.

This jsFiddle shows both cases, with and without scrolling, and can be clearly seen how the sortable item is contained at scrollHeight.

Change History (4)

comment:1 Changed 5 years ago by tj.vantoll

Status: newopen
Summary: Sortable containment doesn't work properly when scrollingSortable: containment doesn't work properly when scrolling

Reduced and updated to the latest version: http://jsfiddle.net/tj_vantoll/2bHSG/6/.

comment:2 Changed 5 years ago by dekajp

@tj

overflow-y: visible|hidden|scroll|auto|no-display|no-content;

looking at the code looks like that the height is always scrollHeight . Am i missing something ?

over = ($(ce).css("overflow") !== "hidden"); if co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight)

comment:3 in reply to:  2 Changed 5 years ago by tj.vantoll

Replying to dekajp:

@tj

overflow-y: visible|hidden|scroll|auto|no-display|no-content;

looking at the code looks like that the height is always scrollHeight . Am i missing something ?

over = ($(ce).css("overflow") !== "hidden"); if co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight)

There's a lot of black magic going on in that portion of sortable. That code in particular is calculating some containment values to be used later. I wouldn't be able to say more without really digging into this.

comment:4 Changed 5 years ago by dekajp

PR (incomplete , lacking unit test cases & closed) -> https://github.com/jquery/jquery-ui/pull/1139

Last edited 5 years ago by dekajp (previous) (diff)
Note: See TracTickets for help on using tickets.