Skip to content

Code Quality: Connected drag events to Omnibar #17245

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Code Quality: Connected drag events to Omnibar #17245

wants to merge 3 commits into from

Conversation

yaira2
Copy link
Member

@yaira2 yaira2 commented Jul 4, 2025

Resolved / Related Issues

To prevent extra work, all changes to the Files codebase must link to an approved issue marked as Ready to build. Please insert the issue number following the hashtag with the issue number that this Pull Request resolves.

Steps used to test these changes

Stability is a top priority for Files and all changes are required to go through testing before being merged into the repo. Please include a list of steps that you used to test this PR.

  1. Confirmed drag & drop events work with both Omnibar and the existing path bar

Copy link
Contributor

@Copilot 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

This PR connects drag-and-drop events for breadcrumb items in the Nav toolbar (Omnibar) by updating the ViewModel logic, wiring handlers in code-behind, and exposing the new events in XAML.

  • Changed event handler casts in ViewModel from StackPanel to FrameworkElement and added null checks
  • Added wrapper methods in NavigationToolbar.xaml.cs to forward drag events to the ViewModel
  • Updated NavigationToolbar.xaml to set AllowDrop and attach DragLeave, DragOver, and Drop handlers

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs Updated casting to FrameworkElement, added null guard and path exclusions
src/Files.App/UserControls/NavigationToolbar.xaml.cs Introduced new event handler methods that call ViewModel
src/Files.App/UserControls/NavigationToolbar.xaml Enabled AllowDrop and hooked up drag-and-drop events
Comments suppressed due to low confidence (1)

src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs:523

  • [nitpick] Consider adding unit or integration tests for the new drag-and-drop methods (PathBoxItem_DragLeave, PathBoxItem_DragOver, PathBoxItem_Drop) to ensure these event handlers are exercised and behave correctly.
		public async Task PathBoxItem_DragOver(object sender, DragEventArgs e)

DataContext="{x:Bind}"
DragLeave="PathBoxItem_DragLeave"
DragOver="PathBoxItem_DragOver"
Drop="PathBoxItem_Drop" />
Copy link
Member

Choose a reason for hiding this comment

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

Please use a more proper name: BreadcrumbBarItem_Drop, etc. PathBoxItem has been inappropriate.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it the same event that works with the existing Breadcrumb box, as well as the Omnibar one? If so, BreadcrumbItem_Drop/DragOver/DragLeave is approriate. Not BreadcrumbBar.

If these are separate events only for the Omnibar, then something like OmnibarBreadcrumbItem_Drop/DragOver/DragLeave would be more accurate.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the review! I pushed a commit with this change.

@yaira2 yaira2 requested a review from 0x5bfa July 4, 2025 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants