Skip to content

Commit 1fabfae

Browse files
authored
Fix: Fixed issue where inactive pane stole focus on file change (#17428)
1 parent ae716a1 commit 1fabfae

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Files.App/ViewModels/ShellViewModel.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public sealed partial class ShellViewModel : ObservableObject, IDisposable
5959
private readonly IStorageCacheService fileListCache = Ioc.Default.GetRequiredService<IStorageCacheService>();
6060
private readonly IWindowsSecurityService WindowsSecurityService = Ioc.Default.GetRequiredService<IWindowsSecurityService>();
6161
private readonly IStorageTrashBinService StorageTrashBinService = Ioc.Default.GetRequiredService<IStorageTrashBinService>();
62+
private readonly IContentPageContext ContentPageContext = Ioc.Default.GetRequiredService<IContentPageContext>();
6263

6364
// Only used for Binding and ApplyFilesAndFoldersChangesAsync, don't manipulate on this!
6465
public BulkConcurrentObservableCollection<ListedItem> FilesAndFolders { get; }
@@ -873,6 +874,11 @@ await dispatcherQueue.EnqueueOrInvokeAsync(() =>
873874

874875
private Task RequestSelectionAsync(List<ListedItem> itemsToSelect)
875876
{
877+
// Don't notify if shell page is not the active pane (eg. Dual Pane)
878+
// https://github.com/files-community/Files/issues/17427
879+
if (WorkingDirectory != ContentPageContext.ShellPage!.ShellViewModel.WorkingDirectory)
880+
return Task.CompletedTask;
881+
876882
// Don't notify if there weren't listed items
877883
if (itemsToSelect is null || itemsToSelect.IsEmpty())
878884
return Task.CompletedTask;

0 commit comments

Comments
 (0)