1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-23 19:15:07 +00:00

LibGUI: Improve TabWidget+StackWidget focus behavior further

When setting a new active widget, transfer focus if it's anywhere in
the old active widget's tree, not just at the immediate child.
This commit is contained in:
Andreas Kling 2020-10-30 19:08:21 +01:00
parent b0cdb6b074
commit dee639f19b
2 changed files with 2 additions and 2 deletions

View file

@ -43,7 +43,7 @@ void StackWidget::set_active_widget(Widget* widget)
if (widget == m_active_widget)
return;
bool active_widget_had_focus = m_active_widget && window() && window()->focused_widget() == m_active_widget;
bool active_widget_had_focus = m_active_widget && window() && (window()->focused_widget() == m_active_widget || m_active_widget->is_ancestor_of(*window()->focused_widget()));
if (m_active_widget)
m_active_widget->set_visible(false);