Skip to content

Feature Request: Add option to lock background interaction while ContextMenu is open #1450

@FlyingYu-Z

Description

@FlyingYu-Z

When using context_menu inside a scrollable container, the background view can still scroll while the context menu is open.
This can cause the menu to move with the scroll or become visually misaligned, which negatively impacts the user experience.

2025.10.28.20.32.56.webm

✨ Requested Feature

It would be great to have an option (or a built-in behavior) that temporarily disables background interaction—especially scrolling—while the ContextMenu is open.
For example, something like:

container
    .context_menu({
        move |this, window, cx| {
+        this.lock_background(true)
                .separator()
                .menu("Open", Box::new(Open))
                .menu("Delete", Box::new(Delete))
        }
    })

✅ Expected Behavior

  • While the context menu is open, background scrolling and dragging should be disabled.
  • Once the menu is closed, background interaction should be automatically restored.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions