Focus toggled elements when interacting with the sidebars

Also, restore focus on the workspace when there is no active item
on the sidebar that was just toggled.
This commit is contained in:
Antonio Scandurra 2021-08-27 10:01:44 +02:00
parent 1489c865e7
commit 386631debf
4 changed files with 16 additions and 1 deletions

View file

@ -767,6 +767,11 @@ impl Workspace {
Side::Right => &mut self.right_sidebar,
};
sidebar.toggle_item(action.0.item_index);
if let Some(active_item) = sidebar.active_item() {
cx.focus(active_item);
} else {
cx.focus_self();
}
cx.notify();
}