Skip to content

Fix: Fixed issue where changing layouts focused the right pane #17419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/Files.App/Views/ShellPanesPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -638,12 +638,20 @@ private void Pane_Loaded(object sender, RoutedEventArgs e)
{
if (sender is UIElement element)
{
element.GettingFocus += Pane_GettingFocus;
element.GotFocus += Pane_GotFocus;
element.RightTapped += Pane_RightTapped;
element.PointerPressed += Pane_PointerPressed;
}
}

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))
args.TryCancel();
}

private void Pane_ContentChanged(object? sender, TabBarItemParameter e)
{
TabBarItemParameter = new()
Expand Down Expand Up @@ -754,6 +762,7 @@ public void Dispose()
{
pane.Loaded -= Pane_Loaded;
pane.ContentChanged -= Pane_ContentChanged;
pane.GettingFocus -= Pane_GettingFocus;
pane.GotFocus -= Pane_GotFocus;
pane.RightTapped -= Pane_RightTapped;
pane.PointerPressed -= Pane_PointerPressed;
Expand Down
Loading