Skip to content

Fix: Fixed issue where delete key wouldn't work after removing item from selection #17348

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
Show file tree
Hide file tree
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
12 changes: 11 additions & 1 deletion src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -884,8 +884,18 @@ private void ItemSelected_Checked(object sender, RoutedEventArgs e)

private void ItemSelected_Unchecked(object sender, RoutedEventArgs e)
{
if (sender is CheckBox checkBox && checkBox.DataContext is ListedItem item && FileList.SelectedItems.Contains(item))
if (sender is not CheckBox checkBox)
return;

if (checkBox.DataContext is ListedItem item && FileList.SelectedItems.Contains(item))
FileList.SelectedItems.Remove(item);

// Workaround for #17298
checkBox.IsTabStop = false;
checkBox.IsEnabled = false;
checkBox.IsEnabled = true;
checkBox.IsTabStop = true;
FileList.Focus(FocusState.Programmatic);
}

private new void FileList_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args)
Expand Down
14 changes: 11 additions & 3 deletions src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -670,10 +670,18 @@ checkBox.DataContext is ListedItem item &&

private void ItemSelected_Unchecked(object sender, RoutedEventArgs e)
{
if (sender is CheckBox checkBox &&
checkBox.DataContext is ListedItem item &&
FileList.SelectedItems.Contains(item))
if (sender is not CheckBox checkBox)
return;

if (checkBox.DataContext is ListedItem item && FileList.SelectedItems.Contains(item))
FileList.SelectedItems.Remove(item);

// Workaround for #17298
checkBox.IsTabStop = false;
checkBox.IsEnabled = false;
checkBox.IsEnabled = true;
checkBox.IsTabStop = true;
FileList.Focus(FocusState.Programmatic);
}

private new void FileList_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args)
Expand Down
Loading