gpui-component
gpui-component copied to clipboard
Feature Request: Add option to lock background interaction while ContextMenu is open
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.
https://github.com/user-attachments/assets/849afbb0-ad30-4b2d-a1c3-41adad3a76df
✨ 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.