Skip to content

Commit 824774c

Browse files
shanselmanCopilot
andcommitted
Fix hidden slash palette key handling
Only trap composer keys while the slash command catalog is still loading and the loading popup is visible. Once the catalog is loaded with no matching command, let no-match slash input behave like ordinary text. Co-authored-by: Copilot App <[email protected]>
1 parent d6a2e1d commit 824774c

2 files changed

Lines changed: 23 additions & 7 deletions

File tree

‎src/OpenClaw.Tray.WinUI/Chat/OpenClawComposer.cs‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -653,11 +653,11 @@ public override Element Render()
653653
return;
654654
}
655655
}
656-
else if (slashActive)
656+
else if (slashActive && Props.AvailableCommands is null)
657657
{
658-
// Popup is up but nothing is selectable: either the catalog is
659-
// still loading or no command matches the typed text.
660-
var slashLoading = Props.AvailableCommands is null;
658+
// The loading popup is visible but nothing is selectable yet.
659+
// No-match input hides the popup, so it must fall through as
660+
// ordinary composer text instead of trapping Tab/Escape/arrows.
661661
if (key == global::Windows.System.VirtualKey.Escape
662662
|| key == global::Windows.System.VirtualKey.Tab)
663663
{
@@ -674,12 +674,10 @@ public override Element Render()
674674
e.Handled = true;
675675
return;
676676
}
677-
if (slashLoading && key == global::Windows.System.VirtualKey.Enter)
677+
if (key == global::Windows.System.VirtualKey.Enter)
678678
{
679679
// We don't yet know whether "/token" is a real command, so
680680
// don't let Enter send it as raw text and race the fetch.
681-
// (Once loaded with no match it's not a command, so Enter
682-
// falls through below and sends as an ordinary message.)
683681
e.Handled = true;
684682
return;
685683
}

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,17 @@ public void SandboxPage_RejectsTurningOnWhenMxcIsDefinitivelyUnavailable()
447447
Assert.Contains("usable MXC backend", reject);
448448
}
449449

450+
[Fact]
451+
public void ChatSlashPalette_HiddenNoMatchStateDoesNotTrapKeys()
452+
{
453+
var source = ReadOpenClawComposerSource();
454+
455+
Assert.Contains("else if (slashActive && Props.AvailableCommands is null)", source);
456+
Assert.Contains("No-match input hides the popup", source);
457+
Assert.Contains("ordinary composer text", source);
458+
Assert.DoesNotContain("var slashLoading = Props.AvailableCommands is null;", source);
459+
}
460+
450461
private static string ReadCoordinatorSource()
451462
{
452463
var root = TestRepositoryPaths.GetRepositoryRoot();
@@ -480,6 +491,13 @@ private static string ReadSandboxPageSource()
480491
root, "src", "OpenClaw.Tray.WinUI", "Pages", "SandboxPage.xaml.cs"));
481492
}
482493

494+
private static string ReadOpenClawComposerSource()
495+
{
496+
var root = TestRepositoryPaths.GetRepositoryRoot();
497+
return File.ReadAllText(Path.Combine(
498+
root, "src", "OpenClaw.Tray.WinUI", "Chat", "OpenClawComposer.cs"));
499+
}
500+
483501
private static string ExtractMethod(string source, string methodName)
484502
{
485503
var match = Regex.Match(

0 commit comments

Comments
 (0)