Skip to content

Commit 197895e

Browse files
committed
Code Quality: Fixed issue where text input lost focus on navigation
1 parent 3806c2b commit 197895e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,10 @@ navigationArguments.SelectItems is not null &&
526526
];
527527

528528
ItemManipulationModel.SetSelectedItems(listedItemsToSelect);
529-
ItemManipulationModel.FocusSelectedItems();
529+
530+
// Don't focus file list if TextBox is focused
531+
if (FocusManager.GetFocusedElement() is not TextBox)
532+
ItemManipulationModel.FocusSelectedItems();
530533
}
531534
else if (navigationArguments is not null && ParentShellPageInstance!.InstanceViewModel.FolderSettings.LayoutMode is not FolderLayoutModes.ColumnView)
532535
{
@@ -535,7 +538,9 @@ navigationArguments.SelectItems is not null &&
535538
await Task.Delay(100);
536539

537540
// Focus on the active pane in case it was lost during navigation
538-
ParentShellPageInstance!.PaneHolder.FocusActivePane();
541+
// Don't focus file list if TextBox is focused
542+
if (FocusManager.GetFocusedElement() is not TextBox)
543+
ParentShellPageInstance!.PaneHolder.FocusActivePane();
539544
}
540545
}
541546
catch (Exception) { }

0 commit comments

Comments
 (0)