From a508ca5e655dcf585242ab00ae417a6c6916af25 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Fri, 15 May 2026 00:16:58 +0200 Subject: [PATCH] Escape closes the flags-filter popup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Standard popup convention; the chips/pills inside don't override KeyDown so the Tunnel-routed handler on the popup root catches the key before any inner control. Arrow-key navigation between chips is a bigger lift (chip groups don't share a focus container) — leaving as a follow-up. Assisted-by: Claude:claude-opus-4-7:Claude Code --- ILSpy/Metadata/MetadataColumnBuilder.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ILSpy/Metadata/MetadataColumnBuilder.cs b/ILSpy/Metadata/MetadataColumnBuilder.cs index d9d66a9e5..ab859dca6 100644 --- a/ILSpy/Metadata/MetadataColumnBuilder.cs +++ b/ILSpy/Metadata/MetadataColumnBuilder.cs @@ -352,12 +352,25 @@ namespace ILSpy.Metadata popupRoot.AddHandler(global::Avalonia.Input.InputElement.PointerWheelChangedEvent, (_, e) => e.Handled = true, handledEventsToo: true); - return new Popup { + var popup = new Popup { PlacementTarget = placementTarget, Placement = PlacementMode.BottomEdgeAlignedLeft, IsLightDismissEnabled = true, Child = popupRoot, }; + // Escape closes the popup — matches the standard popup convention. Tunnel + // routing on the popup root so the key is intercepted before any inner control + // (e.g. the TextBox in a flag-name search field) tries to consume it. + popupRoot.AddHandler(global::Avalonia.Input.InputElement.KeyDownEvent, + (_, e) => { + if (e.Key == global::Avalonia.Input.Key.Escape) + { + popup.IsOpen = false; + e.Handled = true; + } + }, + global::Avalonia.Interactivity.RoutingStrategies.Tunnel); + return popup; } static DataGridTextColumn BuildTextColumn(PropertyInfo prop, ColumnInfoAttribute? info)