Skip to content

Editor doesn't auto-scroll when dragging blocks near viewport edges #75

@reddpy

Description

@reddpy

Description

When dragging a block using the grip handle, moving the cursor near the top or bottom edge of the editor viewport does not auto-scroll. The user has to drop the block, scroll manually, then drag again to move blocks over long distances.

Expected Behavior

The editor should auto-scroll when dragging a block near the top/bottom edges of the viewport, similar to how Notion handles block dragging.

Current Behavior

Dragging a block to the edge of the viewport stops — no scrolling occurs. The drop target line only appears within the currently visible portion of the editor.

Notes

This is a limitation of DraggableBlockPlugin_EXPERIMENTAL from @lexical/react. A fix would likely involve adding a dragover or mousemove listener during drag that calls scrollBy() on the scroll container when the cursor is within a threshold (e.g. 50px) of the top/bottom edge.

Files

  • src/components/editor/plugins/draggable-block-plugin.tsx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions