Skip to content

Commit e42b3cf

Browse files
authored
Fix: Fixed issue with clearing selection via touch (#17441)
1 parent 3c5452c commit e42b3cf

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

src/Files.App/Views/Layouts/ColumnLayoutPage.xaml.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,11 @@ private async void FileList_ItemTapped(object sender, TappedRoutedEventArgs e)
538538
else
539539
{
540540
CloseFolder();
541+
542+
// Clear selection when clicking empty area via touch
543+
// https://github.com/files-community/Files/issues/15051
544+
if (e.PointerDeviceType == PointerDeviceType.Touch)
545+
ItemManipulationModel.ClearSelection();
541546
}
542547
}
543548

src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,13 @@ private async void FileList_ItemTapped(object sender, TappedRoutedEventArgs e)
567567
await CommitRenameAsync(textBox);
568568
}
569569
}
570+
else
571+
{
572+
// Clear selection when clicking empty area via touch
573+
// https://github.com/files-community/Files/issues/15051
574+
if (e.PointerDeviceType == PointerDeviceType.Touch)
575+
ItemManipulationModel.ClearSelection();
576+
}
570577
return;
571578
}
572579

src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,14 @@ private async void FileList_ItemTapped(object sender, TappedRoutedEventArgs e)
610610

611611
var item = (e.OriginalSource as FrameworkElement)?.DataContext as ListedItem;
612612
if (item is null)
613+
{
614+
// Clear selection when clicking empty area via touch
615+
// https://github.com/files-community/Files/issues/15051
616+
if (e.PointerDeviceType == PointerDeviceType.Touch)
617+
ItemManipulationModel.ClearSelection();
618+
613619
return;
620+
}
614621

615622
// Skip code if the control or shift key is pressed or if the user is using multiselect
616623
if (ctrlPressed ||

0 commit comments

Comments
 (0)