mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-10 20:29:05 +00:00
Fix clicking outside of modals to dismiss them
Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
parent
d7f21a9155
commit
5af8ee71aa
1 changed files with 7 additions and 8 deletions
|
@ -3760,20 +3760,19 @@ impl View for Workspace {
|
||||||
)
|
)
|
||||||
}))
|
}))
|
||||||
.with_children(self.modal.as_ref().map(|modal| {
|
.with_children(self.modal.as_ref().map(|modal| {
|
||||||
|
// Prevent clicks within the modal from falling
|
||||||
|
// through to the rest of the workspace.
|
||||||
enum ModalBackground {}
|
enum ModalBackground {}
|
||||||
MouseEventHandler::<ModalBackground, _>::new(
|
MouseEventHandler::<ModalBackground, _>::new(
|
||||||
0,
|
0,
|
||||||
cx,
|
cx,
|
||||||
|_, cx| {
|
|_, cx| ChildView::new(modal.view.as_any(), cx),
|
||||||
ChildView::new(modal.view.as_any(), cx)
|
)
|
||||||
|
.on_click(MouseButton::Left, |_, _, _| {})
|
||||||
.contained()
|
.contained()
|
||||||
.with_style(theme.workspace.modal)
|
.with_style(theme.workspace.modal)
|
||||||
.aligned()
|
.aligned()
|
||||||
.top()
|
.top()
|
||||||
},
|
|
||||||
)
|
|
||||||
.on_click(MouseButton::Left, |_, _, _| {})
|
|
||||||
// Consume click events to stop focus dropping through
|
|
||||||
}))
|
}))
|
||||||
.with_children(self.render_notifications(&theme.workspace, cx)),
|
.with_children(self.render_notifications(&theme.workspace, cx)),
|
||||||
))
|
))
|
||||||
|
|
Loading…
Reference in a new issue