Tig 11 months ago
parent
commit
66f4bef512
2 changed files with 10 additions and 1 deletions
  1. 6 0
      Terminal.Gui/View/View.Navigation.cs
  2. 4 1
      Terminal.Gui/Views/ComboBox.cs

+ 6 - 0
Terminal.Gui/View/View.Navigation.cs

@@ -131,6 +131,12 @@ public partial class View // Focus and cross-view navigation management (TabStop
             }
         }
 
+        if (_hasFocus)
+        {
+            // Something else beat us to the change (likely a FocusChanged handler).
+            return (true, false);
+        }
+
         // By setting _hasFocus to true we definitively change HasFocus for this view.
 
         // Get whatever peer has focus, if any

+ 4 - 1
Terminal.Gui/Views/ComboBox.cs

@@ -414,7 +414,10 @@ public class ComboBox : View, IDesignable
 
     private bool CancelSelected ()
     {
-        _search.SetFocus ();
+        if (HasFocus)
+        {
+            _search.SetFocus ();
+        }
 
         if (ReadOnly || HideDropdownListOnClick)
         {