From 453151c6e7737b17699a15d0256a23419e5c2121 Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Thu, 28 Aug 2025 11:06:20 -0400 Subject: [PATCH 1/6] Code Quality: Fixed keyboard shortcuts when refocusing window --- src/Files.App/UserControls/TabBar/TabBar.xaml | 5 +++-- src/Files.App/UserControls/TabBar/TabBar.xaml.cs | 8 ++++++++ src/Files.App/UserControls/Toolbar.xaml | 3 ++- src/Files.App/UserControls/Toolbar.xaml.cs | 8 ++++++++ src/Files.App/Views/MainPage.xaml.cs | 1 - 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/Files.App/UserControls/TabBar/TabBar.xaml b/src/Files.App/UserControls/TabBar/TabBar.xaml index 2e02a641a7d2..7483a9d30c32 100644 --- a/src/Files.App/UserControls/TabBar/TabBar.xaml +++ b/src/Files.App/UserControls/TabBar/TabBar.xaml @@ -145,7 +145,7 @@ x:Name="SplitPaneMenuItem" x:Load="{x:Bind Commands.SplitPaneHorizontally.IsExecutable, Mode=OneWay}" Text="{helpers:ResourceString Name=SplitPane}"> - + + Loaded="DragAreaRectangle_Loaded" + PointerReleased="DragAreaRectangle_PointerReleased" /> diff --git a/src/Files.App/UserControls/TabBar/TabBar.xaml.cs b/src/Files.App/UserControls/TabBar/TabBar.xaml.cs index 7455e6511038..1173a0ac545b 100644 --- a/src/Files.App/UserControls/TabBar/TabBar.xaml.cs +++ b/src/Files.App/UserControls/TabBar/TabBar.xaml.cs @@ -19,6 +19,7 @@ public sealed partial class TabBar : BaseTabBar, INotifyPropertyChanged private readonly ICommandManager Commands = Ioc.Default.GetRequiredService(); private readonly IAppearanceSettingsService AppearanceSettingsService = Ioc.Default.GetRequiredService(); private readonly IWindowContext WindowContext = Ioc.Default.GetRequiredService(); + private readonly IContentPageContext ContentPageContext = Ioc.Default.GetRequiredService(); // Fields @@ -372,5 +373,12 @@ private async void DragAreaRectangle_Loaded(object sender, RoutedEventArgs e) HorizontalTabView.ActualWidth - TabBarAddNewTabButton.Width - titleBarInset, HorizontalTabView.ActualHeight)); } + + private void DragAreaRectangle_PointerReleased(object sender, PointerRoutedEventArgs e) + { + // Workaround for issue where clicking the drag area prevents keyboard + // shortcuts from working, see https://github.com/microsoft/microsoft-ui-xaml/issues/6467 + DispatcherQueue.TryEnqueue(() => ContentPageContext.ShellPage!.PaneHolder.FocusActivePane()); + } } } \ No newline at end of file diff --git a/src/Files.App/UserControls/Toolbar.xaml b/src/Files.App/UserControls/Toolbar.xaml index 45181870f195..60ea48dab643 100644 --- a/src/Files.App/UserControls/Toolbar.xaml +++ b/src/Files.App/UserControls/Toolbar.xaml @@ -60,7 +60,8 @@ BackgroundSizing="InnerBorderEdge" BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}" BorderThickness="1" - CornerRadius="8"> + CornerRadius="8" + PointerReleased="RootGrid_PointerReleased"> diff --git a/src/Files.App/UserControls/Toolbar.xaml.cs b/src/Files.App/UserControls/Toolbar.xaml.cs index a8910eb0d748..3ce56b1f937f 100644 --- a/src/Files.App/UserControls/Toolbar.xaml.cs +++ b/src/Files.App/UserControls/Toolbar.xaml.cs @@ -17,6 +17,7 @@ public sealed partial class Toolbar : UserControl private readonly ICommandManager Commands = Ioc.Default.GetRequiredService(); private readonly IModifiableCommandManager ModifiableCommands = Ioc.Default.GetRequiredService(); private readonly IAddItemService addItemService = Ioc.Default.GetRequiredService(); + private readonly IContentPageContext ContentPageContext = Ioc.Default.GetRequiredService(); [GeneratedDependencyProperty] public partial NavigationToolbarViewModel? ViewModel { get; set; } @@ -108,5 +109,12 @@ private void AppBarButton_AccessKeyInvoked(UIElement sender, AccessKeyInvokedEve if (VisualTreeHelper.GetOpenPopupsForXamlRoot(MainWindow.Instance.Content.XamlRoot).Any()) args.Handled = true; } + + private void RootGrid_PointerReleased(object sender, PointerRoutedEventArgs e) + { + // Workaround for issue where clicking the toolbar prevents keyboard + // shortcuts from working, see https://github.com/microsoft/microsoft-ui-xaml/issues/6467 + DispatcherQueue.TryEnqueue(() => ContentPageContext.ShellPage!.PaneHolder.FocusActivePane()); + } } } diff --git a/src/Files.App/Views/MainPage.xaml.cs b/src/Files.App/Views/MainPage.xaml.cs index f8f71da7d6b2..3e0c898a4cf3 100644 --- a/src/Files.App/Views/MainPage.xaml.cs +++ b/src/Files.App/Views/MainPage.xaml.cs @@ -162,7 +162,6 @@ public async void MultitaskingControl_CurrentInstanceChanged(object? sender, Cur // Focus the content of the selected tab item (this also avoids an issue where the Omnibar sometimes steals the focus) await Task.Delay(100); ContentPageContext.ShellPage!.PaneHolder.FocusActivePane(); - } private void PaneHolder_PropertyChanged(object? sender, PropertyChangedEventArgs e) From 16c60a97dd896b8237ba883dd52c12dce12a53d3 Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Thu, 28 Aug 2025 11:36:43 -0400 Subject: [PATCH 2/6] Fixed focus issues --- .../Actions/Navigation/NextTabAction.cs | 3 +- .../Actions/Navigation/PreviousTabAction.cs | 3 +- .../Data/Contracts/IShellPanesPage.cs | 5 ++++ src/Files.App/UserControls/TabBar/TabBar.xaml | 3 +- .../UserControls/TabBar/TabBar.xaml.cs | 7 ----- src/Files.App/UserControls/Toolbar.xaml | 13 +++++++-- src/Files.App/UserControls/Toolbar.xaml.cs | 8 ++---- src/Files.App/ViewModels/MainPageViewModel.cs | 2 +- src/Files.App/ViewModels/ShellViewModel.cs | 7 +++++ src/Files.App/Views/Layouts/BaseLayoutPage.cs | 10 +++++-- src/Files.App/Views/MainPage.xaml | 1 + src/Files.App/Views/MainPage.xaml.cs | 7 +++++ src/Files.App/Views/ShellPanesPage.xaml.cs | 28 +++++++++++++++++-- 13 files changed, 73 insertions(+), 24 deletions(-) diff --git a/src/Files.App/Actions/Navigation/NextTabAction.cs b/src/Files.App/Actions/Navigation/NextTabAction.cs index 9a34d91a7ddf..b533d4d3cc22 100644 --- a/src/Files.App/Actions/Navigation/NextTabAction.cs +++ b/src/Files.App/Actions/Navigation/NextTabAction.cs @@ -9,6 +9,7 @@ namespace Files.App.Actions internal sealed partial class NextTabAction : ObservableObject, IAction { private readonly IMultitaskingContext multitaskingContext; + private readonly IContentPageContext contentPageContext = Ioc.Default.GetRequiredService(); public string Label => Strings.NextTab.GetLocalizedResource(); @@ -37,7 +38,7 @@ public async Task ExecuteAsync(object? parameter = null) await Task.Delay(500); // Focus the content of the selected tab item (needed for keyboard navigation) - (multitaskingContext.CurrentTabItem.TabItemContent as Control)?.Focus(FocusState.Programmatic); + contentPageContext.ShellPage!.PaneHolder.FocusActivePane(); } private void MultitaskingContext_PropertyChanged(object? sender, PropertyChangedEventArgs e) diff --git a/src/Files.App/Actions/Navigation/PreviousTabAction.cs b/src/Files.App/Actions/Navigation/PreviousTabAction.cs index c393ae86055b..dbbb49ec4882 100644 --- a/src/Files.App/Actions/Navigation/PreviousTabAction.cs +++ b/src/Files.App/Actions/Navigation/PreviousTabAction.cs @@ -9,6 +9,7 @@ namespace Files.App.Actions internal sealed partial class PreviousTabAction : ObservableObject, IAction { private readonly IMultitaskingContext multitaskingContext; + private readonly IContentPageContext contentPageContext = Ioc.Default.GetRequiredService(); public string Label => Strings.PreviousTab.GetLocalizedResource(); @@ -40,7 +41,7 @@ public async Task ExecuteAsync(object? parameter = null) await Task.Delay(500); // Focus the content of the selected tab item (needed for keyboard navigation) - (multitaskingContext.CurrentTabItem.TabItemContent as Control)?.Focus(FocusState.Programmatic); + contentPageContext.ShellPage!.PaneHolder.FocusActivePane(); } private void MultitaskingContext_PropertyChanged(object? sender, PropertyChangedEventArgs e) diff --git a/src/Files.App/Data/Contracts/IShellPanesPage.cs b/src/Files.App/Data/Contracts/IShellPanesPage.cs index 91632061bbcf..917b7b57110d 100644 --- a/src/Files.App/Data/Contracts/IShellPanesPage.cs +++ b/src/Files.App/Data/Contracts/IShellPanesPage.cs @@ -69,6 +69,11 @@ public interface IShellPanesPage : IDisposable, INotifyPropertyChanged /// public void FocusActivePane(); + /// + /// Locks the active pane. + /// + public void LockActivePane(); + /// /// Gets open panes. /// diff --git a/src/Files.App/UserControls/TabBar/TabBar.xaml b/src/Files.App/UserControls/TabBar/TabBar.xaml index 7483a9d30c32..94613713f1c2 100644 --- a/src/Files.App/UserControls/TabBar/TabBar.xaml +++ b/src/Files.App/UserControls/TabBar/TabBar.xaml @@ -261,8 +261,7 @@ HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Fill="Transparent" - Loaded="DragAreaRectangle_Loaded" - PointerReleased="DragAreaRectangle_PointerReleased" /> + Loaded="DragAreaRectangle_Loaded" /> diff --git a/src/Files.App/UserControls/TabBar/TabBar.xaml.cs b/src/Files.App/UserControls/TabBar/TabBar.xaml.cs index 1173a0ac545b..d83e86034fa8 100644 --- a/src/Files.App/UserControls/TabBar/TabBar.xaml.cs +++ b/src/Files.App/UserControls/TabBar/TabBar.xaml.cs @@ -373,12 +373,5 @@ private async void DragAreaRectangle_Loaded(object sender, RoutedEventArgs e) HorizontalTabView.ActualWidth - TabBarAddNewTabButton.Width - titleBarInset, HorizontalTabView.ActualHeight)); } - - private void DragAreaRectangle_PointerReleased(object sender, PointerRoutedEventArgs e) - { - // Workaround for issue where clicking the drag area prevents keyboard - // shortcuts from working, see https://github.com/microsoft/microsoft-ui-xaml/issues/6467 - DispatcherQueue.TryEnqueue(() => ContentPageContext.ShellPage!.PaneHolder.FocusActivePane()); - } } } \ No newline at end of file diff --git a/src/Files.App/UserControls/Toolbar.xaml b/src/Files.App/UserControls/Toolbar.xaml index 60ea48dab643..27d71b40ade5 100644 --- a/src/Files.App/UserControls/Toolbar.xaml +++ b/src/Files.App/UserControls/Toolbar.xaml @@ -60,8 +60,7 @@ BackgroundSizing="InnerBorderEdge" BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}" BorderThickness="1" - CornerRadius="8" - PointerReleased="RootGrid_PointerReleased"> + CornerRadius="8"> @@ -688,7 +687,10 @@ - + @@ -700,6 +702,7 @@ (); private readonly IModifiableCommandManager ModifiableCommands = Ioc.Default.GetRequiredService(); private readonly IAddItemService addItemService = Ioc.Default.GetRequiredService(); - private readonly IContentPageContext ContentPageContext = Ioc.Default.GetRequiredService(); [GeneratedDependencyProperty] public partial NavigationToolbarViewModel? ViewModel { get; set; } @@ -110,11 +109,10 @@ private void AppBarButton_AccessKeyInvoked(UIElement sender, AccessKeyInvokedEve args.Handled = true; } - private void RootGrid_PointerReleased(object sender, PointerRoutedEventArgs e) + private void LayoutButton_Click(object sender, RoutedEventArgs e) { - // Workaround for issue where clicking the toolbar prevents keyboard - // shortcuts from working, see https://github.com/microsoft/microsoft-ui-xaml/issues/6467 - DispatcherQueue.TryEnqueue(() => ContentPageContext.ShellPage!.PaneHolder.FocusActivePane()); + // Hide flyout after choosing a layout + LayoutFlyout.Hide(); } } } diff --git a/src/Files.App/ViewModels/MainPageViewModel.cs b/src/Files.App/ViewModels/MainPageViewModel.cs index 666157454b0d..d8ffc37faf7a 100644 --- a/src/Files.App/ViewModels/MainPageViewModel.cs +++ b/src/Files.App/ViewModels/MainPageViewModel.cs @@ -391,7 +391,7 @@ private async void ExecuteNavigateToNumberedTabKeyboardAcceleratorCommand(Keyboa await Task.Delay(500); // Focus the content of the selected tab item (needed for keyboard navigation) - (SelectedTabItem?.TabItemContent as Control)?.Focus(FocusState.Programmatic); + context.ShellPage!.PaneHolder.FocusActivePane(); } e.Handled = true; diff --git a/src/Files.App/ViewModels/ShellViewModel.cs b/src/Files.App/ViewModels/ShellViewModel.cs index d81f0e86a2b8..b612e9d2c3f3 100644 --- a/src/Files.App/ViewModels/ShellViewModel.cs +++ b/src/Files.App/ViewModels/ShellViewModel.cs @@ -584,6 +584,13 @@ public ShellViewModel(LayoutPreferencesManager folderSettingsViewModel) private async void LayoutModeChangeRequested(object? sender, LayoutModeEventArgs e) { + // Layout changes can cause the active pane to lose focus. To prevent this, + // the pane is locked here and focus is restored when file loading completes + // in the RefreshItem() method in BaseLayoutPage.cs. + // See https://github.com/files-community/Files/issues/15397 + // See https://github.com/files-community/Files/issues/16530 + ContentPageContext.ShellPage!.PaneHolder.LockActivePane(); + await dispatcherQueue.EnqueueOrInvokeAsync(CheckForBackgroundImage, Microsoft.UI.Dispatching.DispatcherQueuePriority.Low); } diff --git a/src/Files.App/Views/Layouts/BaseLayoutPage.cs b/src/Files.App/Views/Layouts/BaseLayoutPage.cs index 9266926e5fb2..8618c29c7221 100644 --- a/src/Files.App/Views/Layouts/BaseLayoutPage.cs +++ b/src/Files.App/Views/Layouts/BaseLayoutPage.cs @@ -1240,8 +1240,14 @@ private void RefreshItem(SelectorItem container, object item, bool inRecycleQueu if (ParentShellPageInstance.ShellViewModel.EnabledGitProperties is not GitProperties.None && listedItem is IGitItem gitItem) await ParentShellPageInstance.ShellViewModel.LoadGitPropertiesAsync(gitItem); - // Focus file list when items finish loading (#16530) - ItemManipulationModel.FocusFileList(); + // Layout changes can cause the active pane to lose focus. To prevent this, + // the pane is locked in LayoutModeChangeRequested() and focus is restored here + // when file loading completes. + // See https://github.com/files-community/Files/issues/15397 + // See https://github.com/files-community/Files/issues/16530 + + if (ParentShellPageInstance.IsCurrentPane && !ParentShellPageInstance.IsColumnView) + ItemManipulationModel.FocusFileList(); }); } } diff --git a/src/Files.App/Views/MainPage.xaml b/src/Files.App/Views/MainPage.xaml index 73587546e8e5..c977838b3253 100644 --- a/src/Files.App/Views/MainPage.xaml +++ b/src/Files.App/Views/MainPage.xaml @@ -22,6 +22,7 @@ KeyboardAcceleratorPlacementMode="Hidden" Loaded="Page_Loaded" NavigationCacheMode="Required" + PointerReleased="Page_PointerReleased" SizeChanged="Page_SizeChanged" mc:Ignorable="d"> diff --git a/src/Files.App/Views/MainPage.xaml.cs b/src/Files.App/Views/MainPage.xaml.cs index 3e0c898a4cf3..8eae8ef2b823 100644 --- a/src/Files.App/Views/MainPage.xaml.cs +++ b/src/Files.App/Views/MainPage.xaml.cs @@ -476,5 +476,12 @@ private void SettingsButton_AccessKeyInvoked(UIElement sender, AccessKeyInvokedE if (VisualTreeHelper.GetOpenPopupsForXamlRoot(MainWindow.Instance.Content.XamlRoot).Any()) args.Handled = true; } + + private void Page_PointerReleased(object sender, PointerRoutedEventArgs e) + { + // Workaround for issue where clicking an empty area in the window (toolbar, title bar etc) prevents keyboard + // shortcuts from working properly, see https://github.com/microsoft/microsoft-ui-xaml/issues/6467 + DispatcherQueue.TryEnqueue(() => ContentPageContext.ShellPage!.PaneHolder.FocusActivePane()); + } } } \ No newline at end of file diff --git a/src/Files.App/Views/ShellPanesPage.xaml.cs b/src/Files.App/Views/ShellPanesPage.xaml.cs index 204bdde6d1cd..344a5814bf90 100644 --- a/src/Files.App/Views/ShellPanesPage.xaml.cs +++ b/src/Files.App/Views/ShellPanesPage.xaml.cs @@ -228,6 +228,17 @@ public bool IsCurrentInstance } } + private bool _IsActivePaneLocked; + public bool IsActivePaneLocked + { + get => _IsActivePaneLocked; + set + { + if (_IsActivePaneLocked != value) + _IsActivePaneLocked = value; + } + } + // Events public static event EventHandler? CurrentInstanceChanged; @@ -378,6 +389,12 @@ public void FocusActivePane() GetPane(1)?.Focus(FocusState.Programmatic); } + /// + public void LockActivePane() + { + IsActivePaneLocked = true; + } + /// public IEnumerable GetPanes() { @@ -656,9 +673,16 @@ private void Pane_Loaded(object sender, RoutedEventArgs e) private void Pane_GettingFocus(UIElement sender, GettingFocusEventArgs args) { - // Workaround for https://github.com/files-community/Files/issues/15397 - if (args?.NewFocusedElement is not null && args.NewFocusedElement is not (ListViewItem or GridViewItem or ListView or GridView or TextBox)) + // Cancel focus attempts while the active pane is locked during layout changes. + // Pane locking occurs in LayoutModeChangeRequested() in ShellViewModel.cs. + // Focus is restored in RefreshItem() in BaseLayoutPage.cs when file loading completes. + // See https://github.com/files-community/Files/issues/15397 + // See https://github.com/files-community/Files/issues/16530 + if (IsActivePaneLocked) + { + IsActivePaneLocked = false; args.TryCancel(); + } } private void Pane_ContentChanged(object? sender, TabBarItemParameter e) From 023fcc5bc8bd66fd28e0d7372a82516591f9b582 Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Thu, 28 Aug 2025 20:12:15 -0400 Subject: [PATCH 3/6] Update TabBar.xaml.cs --- src/Files.App/UserControls/TabBar/TabBar.xaml.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Files.App/UserControls/TabBar/TabBar.xaml.cs b/src/Files.App/UserControls/TabBar/TabBar.xaml.cs index d83e86034fa8..7455e6511038 100644 --- a/src/Files.App/UserControls/TabBar/TabBar.xaml.cs +++ b/src/Files.App/UserControls/TabBar/TabBar.xaml.cs @@ -19,7 +19,6 @@ public sealed partial class TabBar : BaseTabBar, INotifyPropertyChanged private readonly ICommandManager Commands = Ioc.Default.GetRequiredService(); private readonly IAppearanceSettingsService AppearanceSettingsService = Ioc.Default.GetRequiredService(); private readonly IWindowContext WindowContext = Ioc.Default.GetRequiredService(); - private readonly IContentPageContext ContentPageContext = Ioc.Default.GetRequiredService(); // Fields From a3bf4a0d13a38d92d92fee61185ec5766c322722 Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Thu, 28 Aug 2025 20:23:27 -0400 Subject: [PATCH 4/6] Update MainPage.xaml.cs --- src/Files.App/Views/MainPage.xaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Files.App/Views/MainPage.xaml.cs b/src/Files.App/Views/MainPage.xaml.cs index 8eae8ef2b823..da9dc95347b8 100644 --- a/src/Files.App/Views/MainPage.xaml.cs +++ b/src/Files.App/Views/MainPage.xaml.cs @@ -481,7 +481,7 @@ private void Page_PointerReleased(object sender, PointerRoutedEventArgs e) { // Workaround for issue where clicking an empty area in the window (toolbar, title bar etc) prevents keyboard // shortcuts from working properly, see https://github.com/microsoft/microsoft-ui-xaml/issues/6467 - DispatcherQueue.TryEnqueue(() => ContentPageContext.ShellPage!.PaneHolder.FocusActivePane()); + DispatcherQueue.TryEnqueue(() => ContentPageContext.ShellPage?.PaneHolder.FocusActivePane()); } } } \ No newline at end of file From 3917914ce6019aa658c54a2d56a137f0268e46a7 Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Thu, 28 Aug 2025 20:37:23 -0400 Subject: [PATCH 5/6] Update ShellPanesPage.xaml.cs --- src/Files.App/Views/ShellPanesPage.xaml.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Files.App/Views/ShellPanesPage.xaml.cs b/src/Files.App/Views/ShellPanesPage.xaml.cs index 344a5814bf90..8cefef085eab 100644 --- a/src/Files.App/Views/ShellPanesPage.xaml.cs +++ b/src/Files.App/Views/ShellPanesPage.xaml.cs @@ -383,7 +383,9 @@ public void FocusOtherPane() /// public void FocusActivePane() { - if (ActivePane == (IShellPage)GetPane(0)!) + if (ActivePane is BaseShellPage baseShellPage) + baseShellPage.ContentPage?.ItemManipulationModel.FocusFileList(); + else if (ActivePane == (IShellPage)GetPane(0)!) GetPane(0)?.Focus(FocusState.Programmatic); else GetPane(1)?.Focus(FocusState.Programmatic); From 74f377b18a2bd7364d97d59269f9b0cc0ece7805 Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Thu, 28 Aug 2025 20:54:58 -0400 Subject: [PATCH 6/6] Update ShellPanesPage.xaml.cs --- src/Files.App/Views/ShellPanesPage.xaml.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Files.App/Views/ShellPanesPage.xaml.cs b/src/Files.App/Views/ShellPanesPage.xaml.cs index 8cefef085eab..f2d8d2a3524b 100644 --- a/src/Files.App/Views/ShellPanesPage.xaml.cs +++ b/src/Files.App/Views/ShellPanesPage.xaml.cs @@ -20,6 +20,7 @@ public sealed partial class ShellPanesPage : Page, IShellPanesPage, ITabBarItemC // Dependency injections private IGeneralSettingsService GeneralSettingsService { get; } = Ioc.Default.GetRequiredService(); + private IContentPageContext ContentPageContext { get; } = Ioc.Default.GetRequiredService(); private AppModel AppModel { get; } = Ioc.Default.GetRequiredService(); // Constants @@ -383,12 +384,14 @@ public void FocusOtherPane() /// public void FocusActivePane() { - if (ActivePane is BaseShellPage baseShellPage) - baseShellPage.ContentPage?.ItemManipulationModel.FocusFileList(); - else if (ActivePane == (IShellPage)GetPane(0)!) + if (ActivePane == (IShellPage)GetPane(0)!) GetPane(0)?.Focus(FocusState.Programmatic); else GetPane(1)?.Focus(FocusState.Programmatic); + + // Focus file list + if (ActivePane is BaseShellPage baseShellPage) + baseShellPage.ContentPage?.ItemManipulationModel.FocusFileList(); } ///