react-virtuoso icon indicating copy to clipboard operation
react-virtuoso copied to clipboard

[BUG] Weird scrolling behavior with react-beautiful-dnd

Open loun4 opened this issue 3 years ago • 7 comments

Describe the bug Dragging items to the bottom of the list causes strange scrolling behavior

Reproduction https://codesandbox.io/s/react-virutoso-with-react-beautiful-dnd-forked-pslfr?file=/src/index.js

Screenshots

https://user-images.githubusercontent.com/1511512/128223648-dba6f815-cadc-44a1-9902-f64296693d67.mov

Desktop (please complete the following information):

  • OS: Mac OS 11.5.1.
  • Browser: Browser Chrome 92

loun4 avatar Aug 04 '21 16:08 loun4

Any suggestion or workaround to fix that ?

loun4 avatar Aug 10 '21 08:08 loun4

I think the problem lies somewhere in the sample itself (rather than the library), probably the way the placeholder is calculated.

petyosi avatar Aug 10 '21 12:08 petyosi

Another sample based on the official one (https://virtuoso.dev/react-beautiful-dnd/) : https://codesandbox.io/s/react-virutoso-with-react-beautiful-dnd-bug-wgtmq?file=/src/index.js

We don't understand why this only happens when items are dragged to the bottom.

https://user-images.githubusercontent.com/1511512/129692686-ee29ed62-be69-48e5-b5e0-d85f5adae3a4.mov

loun4 avatar Aug 17 '21 08:08 loun4

Feel free to examine the DOM structure and see what causes the flickering. I am unlikely to get to debugging that anytime soon.

petyosi avatar Aug 17 '21 09:08 petyosi

have you tried adding an extra height to those container divs?

Guiw5 avatar Oct 11 '21 20:10 Guiw5

@loun4 were you able to control it somehow? it only happens when you drag something to the end of any other column. doesn't happen in the same one.

Harshit369 avatar Feb 09 '22 10:02 Harshit369

I had this problem too, the solution for me was to add {provided.placeholder} to the end of the Droppable container

<Droppable droppableId={`${status.Id}`}>
  {provided => {
    const columnFind = columns.find(column => column.statusId === status.Id);

    return (
      <div
        ref={provided.innerRef}
        className={classNames(styles.tasksList, {
          [styles.emptyColumn]: !columnFind?.tasks.length,
        })}
        {...provided.droppableProps}
      >
        {buildTasks(columnFind)}
        {provided.placeholder}
      </div>
    );
  }}
</Droppable>

OleksandrEmpeek avatar Jul 05 '22 15:07 OleksandrEmpeek

Hey, any solution to this? It is only happening for the bottom most element. My hunch is since the virtual list has it as the last element, it is unable to remove the top item and change indexes accordingly and css transition is not applied. Can someone please help?

PS: I tired using provided.placeholder but apparently, virtual lists doesn't require one.

Aditi0505 avatar Nov 01 '23 09:11 Aditi0505

嘿嘿,这个问题有什么解决办法吗?它只发生在最底部的元素上。我的预感是,由于虚拟列表将其作为最后一个元素,因此无法删除顶部项目并相应地更改索引,并且不应用 css转换。有人可以帮忙吗?

PS:我厌倦了使用provided.placeholder,但显然,虚拟列表不需要它。

I want to ask if you have solved this problem?

zhangxuanou avatar Nov 28 '23 05:11 zhangxuanou