Skip to content

Commit f0db3e4

Browse files
committed
Update
1 parent 9396532 commit f0db3e4

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

src/Files.App.Controls/BreadcrumbBar/BreadcrumbBar.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT License.
33

44
using Microsoft.UI.Xaml.Automation;
5+
using Microsoft.UI.Xaml.Input;
56
using Windows.Foundation;
67

78
namespace Files.App.Controls
@@ -25,6 +26,8 @@ public partial class BreadcrumbBar : Control
2526

2627
private bool _isEllipsisRendered;
2728

29+
private bool _focusedViaKeyboard = false; // Used to determine if the BreadcrumbBar was focused via keyboard on Tab focus
30+
2831
// Properties
2932

3033
public int IndexAfterEllipsis
@@ -62,11 +65,18 @@ protected override void OnApplyTemplate()
6265
_ellipsisBreadcrumbBarItem.SetOwner(this);
6366
_itemsRepeater.Layout = _itemsRepeaterLayout;
6467

68+
//GettingFocus += BreadcrumbBar_GettingFocus;
69+
//GettingFocus += BreadcrumbBar_GotFocus;
6570
_itemsRepeater.ElementPrepared += ItemsRepeater_ElementPrepared;
6671
_itemsRepeater.ElementClearing += ItemsRepeater_ElementClearing;
6772
_itemsRepeater.ItemsSourceView.CollectionChanged += ItemsSourceView_CollectionChanged;
6873
}
6974

75+
private void BreadcrumbBar_GettingFocus(UIElement sender, GettingFocusEventArgs args)
76+
{
77+
_focusedViaKeyboard = args.InputDevice is FocusInputDeviceKind.Keyboard;
78+
}
79+
7080
internal protected virtual void RaiseItemClickedEvent(BreadcrumbBarItem item)
7181
{
7282
var index = _itemsRepeater?.GetElementIndex(item) ?? throw new ArgumentNullException($"{_itemsRepeater} is null.");
@@ -122,6 +132,11 @@ internal bool TryGetElement(int index, out BreadcrumbBarItem? item)
122132

123133
// Event methods
124134

135+
private void BreadcrumbBar_GotFocus(object sender, RoutedEventArgs e)
136+
{
137+
_rootBreadcrumbBarItem?.Focus(FocusState.Keyboard);
138+
}
139+
125140
private void ItemsRepeater_ElementPrepared(ItemsRepeater sender, ItemsRepeaterElementPreparedEventArgs args)
126141
{
127142
if (args.Element is not BreadcrumbBarItem item || _itemsRepeater is null)

src/Files.App.Controls/BreadcrumbBar/BreadcrumbBar.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@
5757
Grid.Column="0"
5858
Padding="{StaticResource BreadcrumbBarRootItemPadding}"
5959
CornerRadius="{StaticResource BreadcrumbBarRootItemCornerRadius}"
60-
ItemToolTip="{TemplateBinding RootItemToolTip}">
60+
ItemToolTip="{TemplateBinding RootItemToolTip}"
61+
TabIndex="0">
6162
<ContentPresenter Content="{Binding RootItem, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" />
6263
</local:BreadcrumbBarItem>
6364

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ private void AutoSuggestBox_LosingFocus(UIElement sender, LosingFocusEventArgs a
3333

3434
if (args.InputDevice is FocusInputDeviceKind.Keyboard || args.Direction is FocusNavigationDirection.Next or FocusNavigationDirection.Previous)
3535
{
36-
CurrentSelectedMode?.ContentOnInactive?.Focus(FocusState.Keyboard);
36+
CurrentSelectedMode?.ContentOnInactive?.Focus(FocusState.Programmatic);
3737
}
3838
}
3939

src/Files.App.Controls/Omnibar/Omnibar.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@
117117
<Setter Property="HorizontalContentAlignment" Value="Left" />
118118
<Setter Property="VerticalAlignment" Value="Stretch" />
119119

120-
<Setter Property="IsTabStop" Value="True" />
121-
<Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}" />
120+
<!--<Setter Property="IsTabStop" Value="True" />
121+
<Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}" />-->
122122

123123
<Setter Property="Template">
124124
<Setter.Value>

0 commit comments

Comments
 (0)