Skip to content

Code Quality: Improved Omnibar #17186

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 3 commits into from
Jun 12, 2025
Merged

Code Quality: Improved Omnibar #17186

merged 3 commits into from
Jun 12, 2025

Conversation

yaira2
Copy link
Member

@yaira2 yaira2 commented Jun 12, 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 Command Palette flyout is opened with correct scroll position
  2. Filtered out 'Open Command Palette' action

@yaira2 yaira2 requested a review from Copilot June 12, 2025 18:37
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 enhances the Omnibar by filtering out the “Open Command Palette” suggestion and ensuring the suggestions list scrolls to the top when the popup opens.

  • Exclude the “Open Command Palette” action from the Omnibar’s command-palette mode
  • Subscribe to the suggestions popup’s Opened event
  • Automatically scroll the suggestions list to the first item upon opening

Reviewed Changes

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

File Description
src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs Added a filter to skip the Open Command Palette suggestion
src/Files.App.Controls/Omnibar/Omnibar.cs Wired up the suggestions popup’s Opened event
src/Files.App.Controls/Omnibar/Omnibar.Events.cs Implemented handler to scroll to the first suggestion on Opened
Comments suppressed due to low confidence (3)

src/Files.App.Controls/Omnibar/Omnibar.Events.cs:132

  • This new scrolling behavior isn’t covered by existing tests. Consider adding a unit or UI test to verify that when the popup opens with at least one item, the first suggestion is scrolled into view.
private void AutoSuggestBoxSuggestionsPopup_Opened(object? sender, object e)

src/Files.App.Controls/Omnibar/Omnibar.cs:82

  • If OnApplyTemplate can run multiple times, this handler may be added repeatedly. Consider unsubscribing any existing handler before adding or checking for prior subscription to prevent duplicate invocations.
_textBoxSuggestionsPopup.Opened += AutoSuggestBoxSuggestionsPopup_Opened;

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

  • [nitpick] Comparing Text to Commands.OpenCommandPalette.Code.ToString() is brittle. If Code is already a string, drop the ToString() or, if the suggestion item has a Code property, compare directly to avoid accidental mismatches and improve clarity.
if (item.Text != Commands.OpenCommandPalette.Code.ToString())

@yaira2 yaira2 added the ready to merge Pull requests that are approved and ready to merge label Jun 12, 2025
@yaira2 yaira2 merged commit 378f509 into main Jun 12, 2025
9 checks passed
@yaira2 yaira2 deleted the ya/CP branch June 12, 2025 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Pull requests that are approved and ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant