Skip to content
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
1 change: 1 addition & 0 deletions src/Files.App/UserControls/AddressToolbar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@
BorderBrush="{ThemeResource ControlElevationBorderBrush}"
BorderThickness="1"
CornerRadius="{StaticResource ControlCornerRadius}"
GettingFocus="ClickablePath_GettingFocus"
PointerPressed="ManualPathEntryItem_Click"
Visibility="{x:Bind converters:MultiBooleanConverter.OrNotConvertToVisibility(ShowSearchBox, ViewModel.IsSearchBoxVisible), Mode=OneWay}">
<Grid.ColumnDefinitions>
Expand Down
20 changes: 19 additions & 1 deletion src/Files.App/UserControls/AddressToolbar.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,18 @@ private void ManualPathEntryItem_Click(object _, PointerRoutedEventArgs e)
ViewModel.IsEditModeEnabled = true;
}

private void VisiblePath_KeyDown(object _, KeyRoutedEventArgs e)
private async void VisiblePath_KeyDown(object _, KeyRoutedEventArgs e)
{
if (e.Key is VirtualKey.Escape)
ViewModel.IsEditModeEnabled = false;

if (e.Key is VirtualKey.Tab)
{
ViewModel.IsEditModeEnabled = false;
// Delay to ensure clickable path is ready to be focused
await Task.Delay(10);
ClickablePath.Focus(FocusState.Keyboard);
}
}
private void VisiblePath_LostFocus(object _, RoutedEventArgs e)
{
Expand Down Expand Up @@ -216,5 +224,15 @@ private void HistoryItemClicked(ToolbarHistoryItemModel? itemModel)
shellPage.Forward_Click();
}
}

private void ClickablePath_GettingFocus(UIElement sender, GettingFocusEventArgs args)
{
if (args.InputDevice != FocusInputDeviceKind.Keyboard)
return;

var previousControl = args.OldFocusedElement as FrameworkElement;
if (previousControl?.Name == nameof(HomeButton) || previousControl?.Name == nameof(Refresh))
ViewModel.IsEditModeEnabled = true;
}
}
}
Loading