Skip to content

Commit ec71a9f

Browse files
committed
Code Quality: Only lock pane when layout mode changes
1 parent 10f2ce5 commit ec71a9f

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/Files.App/ViewModels/ShellViewModel.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -584,13 +584,6 @@ public ShellViewModel(LayoutPreferencesManager folderSettingsViewModel)
584584

585585
private async void LayoutModeChangeRequested(object? sender, LayoutModeEventArgs e)
586586
{
587-
// Layout changes can cause the active pane to lose focus. To prevent this,
588-
// the pane is locked here and focus is restored when file loading completes
589-
// in the RefreshItem() method in BaseLayoutPage.cs.
590-
// See https://github.com/files-community/Files/issues/15397
591-
// See https://github.com/files-community/Files/issues/16530
592-
ContentPageContext.ShellPage!.PaneHolder.LockActivePane();
593-
594587
await dispatcherQueue.EnqueueOrInvokeAsync(CheckForBackgroundImage, Microsoft.UI.Dispatching.DispatcherQueuePriority.Low);
595588
}
596589

src/Files.App/Views/Layouts/BaseLayoutPage.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,13 @@ protected virtual void BaseFolderSettings_LayoutModeChangeRequested(object? send
372372

373373
if (layoutType != ParentShellPageInstance.CurrentPageType)
374374
{
375+
// Layout changes can cause the active pane to lose focus. To prevent this,
376+
// the pane is locked here and focus is restored when file loading completes
377+
// in the RefreshItem() method in BaseLayoutPage.cs.
378+
// See https://github.com/files-community/Files/issues/15397
379+
// See https://github.com/files-community/Files/issues/16530
380+
ParentShellPageInstance!.PaneHolder.LockActivePane();
381+
375382
ParentShellPageInstance.NavigateWithArguments(layoutType, new NavigationArguments()
376383
{
377384
NavPathParam = navigationArguments!.NavPathParam,

src/Files.App/Views/ShellPanesPage.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ private void Pane_Loaded(object sender, RoutedEventArgs e)
679679
private void Pane_GettingFocus(UIElement sender, GettingFocusEventArgs args)
680680
{
681681
// Cancel focus attempts while the active pane is locked during layout changes.
682-
// Pane locking occurs in LayoutModeChangeRequested() in ShellViewModel.cs.
682+
// Pane locking occurs in BaseFolderSettings_LayoutModeChangeRequested() in BaseLayoutPage.cs.
683683
// Focus is restored in RefreshItem() in BaseLayoutPage.cs when file loading completes.
684684
// See https://github.com/files-community/Files/issues/15397
685685
// See https://github.com/files-community/Files/issues/16530

0 commit comments

Comments
 (0)