UI: Avoid looping at end of window content

This commit is contained in:
Luke Street
2026-05-04 11:49:12 -06:00
parent f61bd3e5ad
commit 5121437bcf
3 changed files with 7 additions and 3 deletions
-1
View File
@@ -136,7 +136,6 @@ SelectButton& config_percent_select(Pane& leftPane, Pane& rightPane, ConfigVar<f
} // namespace
SettingsWindow::SettingsWindow() {
add_tab("Graphics", [this](Rml::Element* content) {
auto& leftPane = add_child<Pane>(content, Pane::Type::Controlled);
auto& rightPane = add_child<Pane>(content, Pane::Type::Uncontrolled);
+4 -2
View File
@@ -97,8 +97,10 @@ void update() noexcept {
if (auto* context = aurora::rmlui::get_context();
context != nullptr && context->GetFocusElement() == nullptr)
{
if (auto* top = top_document()) {
top->focus();
for (auto& doc : std::views::reverse(sDocuments)) {
if (!doc->closed() && !doc->pending_close() && doc->focus()) {
break;
}
}
}
+3
View File
@@ -198,6 +198,9 @@ bool Window::handle_content_nav(Rml::Event& event, NavCommand cmd) noexcept {
return true;
}
return false;
} else if (cmd == NavCommand::Down) {
// End of content, avoid looping
return true;
} else if (cmd == NavCommand::Cancel) {
int currentComponent = -1;
for (int i = 0; i < mContentComponents.size(); ++i) {