Skip to content

Add 'Remove all tags' ption for files and folders#18262

Open
shivansh31414 wants to merge 1 commit intofiles-community:mainfrom
shivansh31414:feature-remove-all-tags
Open

Add 'Remove all tags' ption for files and folders#18262
shivansh31414 wants to merge 1 commit intofiles-community:mainfrom
shivansh31414:feature-remove-all-tags

Conversation

@shivansh31414
Copy link

Resolved / Related Issues
Closes Feature: Add “Remove all tags” option for files and folders

Steps used to test these changes
Applied multiple tags to files and folders.

Used the new “Remove all tags” option from the context menu.

Verified all tags were cleared in one action.

Confirmed UI updated correctly in the Status Center.

Tested with items that had no tags to ensure graceful handling.

Checked multiple selections to confirm consistent behavior.

Ran accessibility checks with Accessibility Insights for Windows.

Validated no regressions or memory leaks occurred.

Copilot AI review requested due to automatic review settings March 15, 2026 10:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a "Remove all tags" context menu option for files and folders, allowing users to clear all tag metadata in a single action. This is backed by a new FileTagsContextMenuViewModel that encapsulates tag manipulation logic, extracted from the UI layer.

Changes:

  • New FileTagsContextMenuViewModel with RemoveAllTags, UpdateTagSelection, and IsTagAppliedToAllSelectedItems methods
  • Refactored FileTagsContextMenu to use the new ViewModel and added a "Remove all tags" menu item
  • Added comprehensive unit tests and the localized string resource

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Files.App/ViewModels/UserControls/Menus/FileTagsContextMenuViewModel.cs New ViewModel encapsulating tag add/remove/clear logic
src/Files.App/UserControls/Menus/FileTagsContextMenu.cs Refactored to use ViewModel; added "Remove all tags" menu item
src/Files.App/Strings/en-US/Resources.resw Added RemoveAllTags localized string
tests/Files.InteractionTests/Files.InteractionTests.csproj Added project reference and DI package for tests
tests/Files.InteractionTests/Tests/FileTagsContextMenuViewModelTests.cs Unit tests for the new ViewModel

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +79 to +84
removeAllTagsMenuItem.IsEnabled = viewModel.CanRemoveAllTags;
}

private void RemoveFileTag(IEnumerable<ListedItem> selectedListedItems, TagViewModel removed)
private void Item_Opening(object? sender, object e)
{
foreach (var selectedItem in selectedListedItems)
{
var existingTags = selectedItem.FileTags ?? [];
if (existingTags.Contains(removed.Uid))
{
var tagList = existingTags.Except(new[] { removed.Uid }).ToArray();
selectedItem.FileTags = tagList;
}
}
TagsChanged?.Invoke(this, EventArgs.Empty);
removeAllTagsMenuItem.IsEnabled = viewModel.CanRemoveAllTags;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Add "Remove all tags" option for files and folders

2 participants