Skip to content

Feature: Added support for opening the breadcrumb dropdown via keyboard navigation #16092

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 1 commit into from
Aug 27, 2024
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
4 changes: 3 additions & 1 deletion src/Files.App/UserControls/PathBreadcrumb.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@
Background="Transparent"
BorderBrush="Transparent"
CornerRadius="0,4,4,0"
DataContextChanged="PathItemSeparator_DataContextChanged">
DataContextChanged="PathItemSeparator_DataContextChanged"
IsTabStop="False">
<Button.Flyout>
<MenuFlyout
x:Name="ExpandMenuFlyout"
Expand Down Expand Up @@ -133,6 +134,7 @@
IsItemClickEnabled="True"
ItemTemplateSelector="{StaticResource PathBreadcrumbItemSelector}"
ItemsSource="{x:Bind ViewModel.PathComponents, Mode=OneWay}"
KeyDown="PathBoxItem_KeyDown"
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.HorizontalScrollMode="Enabled"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
Expand Down
5 changes: 5 additions & 0 deletions src/Files.App/UserControls/PathBreadcrumb.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,10 @@ private void PathBoxItem_PointerPressed(object sender, PointerRoutedEventArgs e)
{
ViewModel.PathBoxItem_PointerPressed(sender, e);
}

private void PathBoxItem_KeyDown(object sender, KeyRoutedEventArgs e)
{
ViewModel.PathBoxItem_KeyDown(sender, e);
}
}
}
11 changes: 11 additions & 0 deletions src/Files.App/ViewModels/UserControls/AddressToolbarViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,17 @@ await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(async () =>
});
}

public void PathBoxItem_KeyDown(object sender, KeyRoutedEventArgs e)
{
if (e.Key == Windows.System.VirtualKey.Down)
{
var item = e.OriginalSource as ListViewItem;
var button = item?.FindDescendant<Button>();
button?.Flyout.ShowAt(button);
e.Handled = true;
}
}

public void OpenCommandPalette()
{
PathText = ">";
Expand Down