Browse Source

Fixsed colorpicker tab order

Tig 11 months ago
parent
commit
6667b33cf5

+ 7 - 4
Terminal.Gui/View/View.Navigation.cs

@@ -33,7 +33,7 @@ public partial class View // Focus and cross-view navigation management (TabStop
     ///         focusable to also gain focus (as long as <see cref="TabStop"/>
     ///     </para>
     ///     <para>
-    ///         Setting this property to <see langword="false"/> will cause <see cref="ApplicationNavigation.MoveNextView"/> to set
+    ///         Setting this property to <see langword="false"/> will cause <see cref="AdvanceFocus"/> to set
     ///         the focus on the next view to be focused.
     ///     </para>
     /// </remarks>
@@ -429,10 +429,13 @@ public partial class View // Focus and cross-view navigation management (TabStop
             // We're moving beyond the last subview
 
             // Determine if focus should remain in this focus chain, or move to the superview's focus chain
-            if (SuperView is { } && SuperView.GetScopedTabIndexes (direction, behavior).Length > 1)
+            if (SuperView is { } && SuperView.TabStop != TabBehavior.NoStop && SuperView.GetScopedTabIndexes (direction, behavior).Length > 1)
             {
-                // Our superview has an focusable subview in addition to us
-                return false;
+                //if (behavior == TabBehavior.TabGroup && behavior == TabStop && SuperView?.TabStop == TabBehavior.TabGroup)
+                {
+                    // Our superview has an focusable subview in addition to us
+                    return false;
+                }
             }
 
             // If our superview 

+ 7 - 2
Terminal.Gui/Views/ColorPicker.cs

@@ -52,9 +52,10 @@ public class ColorPicker : View
             bar.Y = y;
             bar.Width = Dim.Fill (Style.ShowTextFields ? textFieldWidth : 0);
 
+            TextField? tfValue = null;
             if (Style.ShowTextFields)
             {
-                var tfValue = new TextField
+                tfValue = new TextField
                 {
                     X = Pos.AnchorEnd (textFieldWidth),
                     Y = y,
@@ -62,7 +63,6 @@ public class ColorPicker : View
                 };
                 tfValue.HasFocusChanged += UpdateSingleBarValueFromTextField;
                 _textFields.Add (bar, tfValue);
-                Add (tfValue);
             }
 
             y++;
@@ -72,6 +72,11 @@ public class ColorPicker : View
             _bars.Add (bar);
 
             Add (bar);
+
+            if (tfValue is { })
+            {
+                Add (tfValue);
+            }
         }
 
         if (Style.ShowColorName)

+ 1 - 1
UICatalog/Scenarios/ViewExperiments.cs

@@ -100,7 +100,7 @@ public class ViewExperiments : Scenario
             Id = $"Tiled{id}",
             BorderStyle = LineStyle.Single,
             CanFocus = true, // Can't drag without this? BUGBUG
-            TabStop = TabBehavior.TabGroup,
+            TabStop = TabBehavior.TabStop,
             Arrangement = ViewArrangement.Fixed
         };