Skip to content

Commit a23953f

Browse files
committed
Code Quality: Close Omnibar when focusing active pane via touch
1 parent e42b3cf commit a23953f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,11 @@ private void Pane_ContentChanged(object? sender, TabBarItemParameter e)
668668

669669
private void Pane_PointerPressed(object sender, PointerRoutedEventArgs e)
670670
{
671-
if (sender != ActivePane && sender is IShellPage shellPage && shellPage.SlimContentPage is not ColumnsLayoutPage)
671+
// Focus pane if interaction suggests intent to focus:
672+
// 1. Sender is not the currently active pane (user is switching panes), or the sender is the active pane,
673+
// but the user is refocusing the pane (e.g. user taps pane to refocus while the Omnibar flyout is open)
674+
// 2. AND the sender is a valid shell page not using a column-based layout
675+
if ((sender != ActivePane || e.Pointer.PointerDeviceType == PointerDeviceType.Touch) && sender is IShellPage shellPage && shellPage.SlimContentPage is not ColumnsLayoutPage)
672676
(sender as UIElement)?.Focus(FocusState.Pointer);
673677
}
674678

0 commit comments

Comments
 (0)