Primitives · Focus: an overlay dropped without Close hands focus back to what it took it from
This commit is contained in:
3 files changed
+52
-4
No files matched your search
@@ -136,6 +136,7 @@ impl Render for Stage {
|
||||
.into_any_element(),
|
||||
});
|
||||
FocusScope::new(&self.root)
|
||||
.root()
|
||||
.size_full()
|
||||
.child(popover)
|
||||
.child(div().h(px(52.0)))
|
||||
@@ -260,6 +261,19 @@ fn escape_closes_a_dialog_and_hands_focus_back(cx: &mut TestAppContext) {
|
||||
assert!(cx.update(|window, _| before.is_focused(window)));
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
fn a_dialog_its_owner_drops_hands_focus_back(cx: &mut TestAppContext) {
|
||||
let (view, cx) = stage(cx);
|
||||
show(&view, Open::Plain, cx);
|
||||
assert!(!before_focused(&view, cx), "the dialog holds focus");
|
||||
view.update(cx, |stage, cx| {
|
||||
stage.open = None;
|
||||
cx.notify();
|
||||
});
|
||||
settle(cx);
|
||||
assert!(before_focused(&view, cx), "focus went back");
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
fn the_scrim_closes_a_dialog_but_not_an_alert(cx: &mut TestAppContext) {
|
||||
let (view, cx) = stage(cx);
|
||||
|
||||
Reference in new issue
Block a user