From 7d9ace4992f76f899f618ce24cbfe549dba1f678 Mon Sep 17 00:00:00 2001 From: Olivier FAURE Date: Tue, 17 Sep 2024 15:19:55 +0200 Subject: [PATCH] Fix update_focus_chain pass --- masonry/src/passes/update.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/masonry/src/passes/update.rs b/masonry/src/passes/update.rs index b7381ff1b..1e4c2bba2 100644 --- a/masonry/src/passes/update.rs +++ b/masonry/src/passes/update.rs @@ -511,10 +511,6 @@ fn update_focus_chain_for_widget( widget_children: widget.children.reborrow_mut(), }; widget.item.lifecycle(&mut ctx, &LifeCycle::BuildFocusChain); - - if !state.item.is_disabled { - parent_focus_chain.extend(&state.item.focus_chain); - } } state.item.update_focus_chain = false; @@ -534,6 +530,10 @@ fn update_focus_chain_for_widget( }, ); + if !state.item.is_disabled { + parent_focus_chain.extend(&state.item.focus_chain); + } + // had_focus is the old focus value. state.has_focus was replaced with parent_ctx.is_focused(). // Therefore if had_focus is true but state.has_focus is false then the widget which is // currently focused is not part of the functional tree anymore