From b717ca35a08035068824cc0682e815b88c2af2e3 Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Wed, 13 Aug 2025 22:59:53 -0400 Subject: [PATCH 1/3] Fix: Fixed issue with clearing selection via touch --- src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs | 7 +++++++ src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs b/src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs index aba8740b9d4c..8df75467a078 100644 --- a/src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs +++ b/src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs @@ -567,6 +567,13 @@ private async void FileList_ItemTapped(object sender, TappedRoutedEventArgs e) await CommitRenameAsync(textBox); } } + else + { + // Clear selection when clicking empty area via touch + // https://github.com/files-community/Files/issues/15051 + if (e.PointerDeviceType == PointerDeviceType.Touch) + ItemManipulationModel.ClearSelection(); + } return; } diff --git a/src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs b/src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs index 1c16bacedfc4..a98848111c46 100644 --- a/src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs +++ b/src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs @@ -610,7 +610,12 @@ private async void FileList_ItemTapped(object sender, TappedRoutedEventArgs e) var item = (e.OriginalSource as FrameworkElement)?.DataContext as ListedItem; if (item is null) - return; + { + // Clear selection when clicking empty area via touch + // https://github.com/files-community/Files/issues/15051 + if (e.PointerDeviceType == PointerDeviceType.Touch) + ItemManipulationModel.ClearSelection(); + } // Skip code if the control or shift key is pressed or if the user is using multiselect if (ctrlPressed || From 3ab05e41f03b340494366ca263342cd9afab2c19 Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Wed, 13 Aug 2025 23:02:43 -0400 Subject: [PATCH 2/3] Update GridLayoutPage.xaml.cs --- src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs b/src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs index a98848111c46..fc8c900678a8 100644 --- a/src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs +++ b/src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs @@ -615,6 +615,8 @@ private async void FileList_ItemTapped(object sender, TappedRoutedEventArgs e) // https://github.com/files-community/Files/issues/15051 if (e.PointerDeviceType == PointerDeviceType.Touch) ItemManipulationModel.ClearSelection(); + + return; } // Skip code if the control or shift key is pressed or if the user is using multiselect From 1fadd47b082c5d7e0a6bc47667188b6139ee6b18 Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Thu, 14 Aug 2025 10:10:16 -0400 Subject: [PATCH 3/3] Update ColumnLayoutPage.xaml.cs --- src/Files.App/Views/Layouts/ColumnLayoutPage.xaml.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Files.App/Views/Layouts/ColumnLayoutPage.xaml.cs b/src/Files.App/Views/Layouts/ColumnLayoutPage.xaml.cs index 71090606b7e1..3776eae8bcd3 100644 --- a/src/Files.App/Views/Layouts/ColumnLayoutPage.xaml.cs +++ b/src/Files.App/Views/Layouts/ColumnLayoutPage.xaml.cs @@ -538,6 +538,11 @@ private async void FileList_ItemTapped(object sender, TappedRoutedEventArgs e) else { CloseFolder(); + + // Clear selection when clicking empty area via touch + // https://github.com/files-community/Files/issues/15051 + if (e.PointerDeviceType == PointerDeviceType.Touch) + ItemManipulationModel.ClearSelection(); } }