From 37d1aa7f404ab5bcd8ac4c60ffeb5c85289f0718 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Thu, 30 Apr 2026 01:07:11 -0600 Subject: [PATCH] UI: Run builder before moving it --- src/dusk/ui/window.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dusk/ui/window.cpp b/src/dusk/ui/window.cpp index 2b6669e558..5e29712944 100644 --- a/src/dusk/ui/window.cpp +++ b/src/dusk/ui/window.cpp @@ -184,6 +184,9 @@ bool Window::set_active_tab(int index) { void Window::add_tab(const Rml::String& title, TabBuilder builder) { const int index = static_cast(mTabs.size()); + if (index == mSelectedTabIndex && builder) { + builder(mDocument->GetElementById("content")); + } auto* tabBar = mDocument->GetElementById("tab-bar"); mTabs.emplace_back(Tab{ .title = title, @@ -196,8 +199,7 @@ void Window::add_tab(const Rml::String& title, TabBuilder builder) { "tab"), .builder = std::move(builder), }); - if (index == mSelectedTabIndex && builder) { - builder(mDocument->GetElementById("content")); + if (index == mSelectedTabIndex) { focus_active_tab(); } }