From 4b331dbef7374747df8346c44755cdd339618c92 Mon Sep 17 00:00:00 2001 From: adnan-bhaldar Date: Thu, 19 Nov 2026 10:59:31 +0530 Subject: [PATCH 1/2] fix(toolbar): show the focus ring only for keyboard use After clicking Edit Donut Size or Done on the Toolbar page, the page hands the keyboard focus to the button that takes its place (KeepFocus). It did so with NavigationMethod.Tab, so the focus ring was drawn even though the user had used the mouse. Remember whether the last input was a key press or a click, and give the focus with NavigationMethod.Pointer after a click, so no ring is drawn. After a key press it is still given with Tab, so keyboard users see the ring. --- src/Filee.App/Views/Pages/ToolbarPage.axaml.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Filee.App/Views/Pages/ToolbarPage.axaml.cs b/src/Filee.App/Views/Pages/ToolbarPage.axaml.cs index a435041d6..893eb4da1 100644 --- a/src/Filee.App/Views/Pages/ToolbarPage.axaml.cs +++ b/src/Filee.App/Views/Pages/ToolbarPage.axaml.cs @@ -95,6 +95,11 @@ public ToolbarPage() // drag goes on. Root.AddHandler(PointerCaptureLostEvent, OnRootCaptureLost, RoutingStrategies.Direct, handledEventsToo: true); AddHandler(GotFocusEvent, (_, e) => _lastFocused = e.Source as Control, RoutingStrategies.Bubble, handledEventsToo: true); + // The last input decides whether a focus the page gives (KeepFocus) draws the focus ring: a key press, yes; a + // click, no. Taken from the input itself, not from the last focus change, which doesn't happen at all when the + // clicked control already has the keyboard. + AddHandler(KeyDownEvent, (_, _) => _focusByKeyboard = true, RoutingStrategies.Tunnel, handledEventsToo: true); + AddHandler(PointerPressedEvent, (_, _) => _focusByKeyboard = false, RoutingStrategies.Tunnel, handledEventsToo: true); // Before the list box, which doesn't move between the rows of its wrap panel. PaletteTabs.AddHandler(KeyDownEvent, OnTabsKeyDown, RoutingStrategies.Tunnel); @@ -170,12 +175,17 @@ private void KeepFocus() || !hidden.GetVisualAncestors().Contains(this)) return; Control next = vm.IsAdjustingLook ? LookDone : vm.IsEditingGroup ? GroupBack : EditSize; - next.Focus(NavigationMethod.Tab); + // The focus ring is for the keyboard: after a click on Edit Donut Size or Done, the button that takes over keeps + // the keyboard but doesn't draw the ring (Tab would draw it, as if the user had tabbed there). + next.Focus(_focusByKeyboard ? NavigationMethod.Tab : NavigationMethod.Pointer); } // The control of this page that last had the keyboard (see KeepFocus). private Control? _lastFocused; + /// The last input was a key press, not a click. + private bool _focusByKeyboard; + /// /// The donut on screen while it's wanted: refilled when what is on it changed (, and only /// then: a search typed in the palette rebuilds the editor but changes nothing on it), else restyled; put away @@ -902,4 +912,4 @@ private void EndDrag() Donut.SetDimmedIndex(-1); PaletteBox.Classes.Set("over", false); } -} +} \ No newline at end of file From 44ffe8cbeb268503ffe91cd0b0217e2eea1034b2 Mon Sep 17 00:00:00 2001 From: adnan-bhaldar Date: Thu, 19 Nov 2026 11:02:35 +0530 Subject: [PATCH 2/2] fix(toolbar): ensure proper file termination in ToolbarPage.axaml.cs --- src/Filee.App/Views/Pages/ToolbarPage.axaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Filee.App/Views/Pages/ToolbarPage.axaml.cs b/src/Filee.App/Views/Pages/ToolbarPage.axaml.cs index 893eb4da1..ade2489c8 100644 --- a/src/Filee.App/Views/Pages/ToolbarPage.axaml.cs +++ b/src/Filee.App/Views/Pages/ToolbarPage.axaml.cs @@ -912,4 +912,4 @@ private void EndDrag() Donut.SetDimmedIndex(-1); PaletteBox.Classes.Set("over", false); } -} \ No newline at end of file +}