Manually focus panes after swapping them (#19024)

(cherry picked from commit bd7e3179ff1c41e9147d99253a9ab150cf9e942a)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgbeR18
Service-Version: 1.22
This commit is contained in:
Carlos Zamora 2025-06-13 15:43:13 -07:00 committed by Dustin L. Howett
parent 65d3a281c2
commit fa8520e581

View File

@ -697,12 +697,24 @@ bool Pane::SwapPanes(std::shared_ptr<Pane> first, std::shared_ptr<Pane> second)
// Refocus the last pane if there was a pane focused
if (const auto focus = first->GetActivePane())
{
focus->_Focus();
// GH#18184: manually focus the pane and content.
// _Focus() results in no-op because the pane was _lastActive
focus->GotFocus.raise(focus, FocusState::Programmatic);
if (const auto& lastContent{ focus->GetLastFocusedContent() })
{
lastContent.Focus(FocusState::Programmatic);
}
}
if (const auto focus = second->GetActivePane())
{
focus->_Focus();
// GH#18184: manually focus the pane and content.
// _Focus() results in no-op because the pane was _lastActive
focus->GotFocus.raise(focus, FocusState::Programmatic);
if (const auto& lastContent{ focus->GetLastFocusedContent() })
{
lastContent.Focus(FocusState::Programmatic);
}
}
return true;