Skip to content

Commit 5bb1a5a

Browse files
shanselmanCopilot
andcommitted
Remove stale overflow 'More' button when wizard step resets
The 'More v' overflow toggle is inserted as a sibling of SelectOptions in the shared StackPanel, but ResetInputs only cleared SelectOptions.Items. Advancing past a select step without clicking More left the button orphaned on subsequent steps. Track it and remove it in ResetInputs. Co-authored-by: Copilot App <[email protected]>
1 parent cad90d5 commit 5bb1a5a

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

‎src/OpenClaw.SetupEngine.UI/Pages/WizardPage.xaml.cs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ public sealed partial class WizardPage : Page
3636
private readonly Dictionary<string, int> _stepVisits = new(StringComparer.OrdinalIgnoreCase);
3737
private readonly List<WizardOptionValue> _options = [];
3838
private readonly Stack<JsonElement> _stepHistory = new();
39+
// "More ▾" overflow toggle lives as a sibling of SelectOptions, so track it to remove between steps.
40+
private Button? _moreOptionsButton;
3941
// wizard.payload frames do not include plugin console output, so tail the gateway log inline.
4042
private WizardConsoleTail? _consoleTail;
4143
// Captured on connect for "Open terminal" / "Restart gateway" recovery actions.
@@ -461,6 +463,8 @@ private bool BuildOptions(JsonElement step, JsonElement initial)
461463
// Remove the More button
462464
if (moreButton.Parent is Panel parent)
463465
parent.Children.Remove(moreButton);
466+
if (ReferenceEquals(_moreOptionsButton, moreButton))
467+
_moreOptionsButton = null;
464468

465469
if (hasGatewayMore && !string.IsNullOrEmpty(gatewayMoreValue))
466470
{
@@ -485,6 +489,7 @@ private bool BuildOptions(JsonElement step, JsonElement initial)
485489
{
486490
var idx = parentPanel.Children.IndexOf(SelectOptions);
487491
parentPanel.Children.Insert(idx + 1, moreButton);
492+
_moreOptionsButton = moreButton;
488493
}
489494
}
490495

@@ -989,6 +994,9 @@ private int TimeoutForCurrentStep()
989994

990995
private void ResetInputs()
991996
{
997+
if (_moreOptionsButton?.Parent is Panel morePanel)
998+
morePanel.Children.Remove(_moreOptionsButton);
999+
_moreOptionsButton = null;
9921000
SelectOptions.Items.Clear();
9931001
SelectOptions.Visibility = Visibility.Collapsed;
9941002
MultiOptions.Children.Clear();

‎tests/OpenClaw.Tray.Tests/AppRefactorContractTests.cs‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,20 @@ public void WizardProgressPolling_UsesStepIdForTimeoutClassification()
606606
Assert.Contains("WizardTimeouts.ForStep(title, message, _stepId)", source);
607607
}
608608

609+
[Fact]
610+
public void WizardResetInputs_RemovesOverflowMoreButton()
611+
{
612+
var root = TestRepositoryPaths.GetRepositoryRoot();
613+
var source = File.ReadAllText(Path.Combine(root, "src", "OpenClaw.SetupEngine.UI", "Pages", "WizardPage.xaml.cs"));
614+
var reset = ExtractMethod(source, "ResetInputs");
615+
616+
// The "More ▾" overflow button is a sibling of SelectOptions in the shared
617+
// StackPanel, so ResetInputs must remove it between steps or it leaks forward.
618+
Assert.Contains("_moreOptionsButton", reset);
619+
Assert.Contains("morePanel.Children.Remove(_moreOptionsButton)", reset);
620+
Assert.Contains("_moreOptionsButton = null", reset);
621+
}
622+
609623
[Fact]
610624
public void WizardCompletion_AppliesWindowsNodeContextBeforeSummary()
611625
{

0 commit comments

Comments
 (0)