File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 5
5
TargetType =" dialogHost:DialogOverlayPopupHost" >
6
6
<Setter Property =" Background" Value =" {DynamicResource ThemeBackgroundBrush}" />
7
7
<Setter Property =" KeyboardNavigation.TabNavigation" Value =" Cycle" />
8
+ <Setter Property =" Focusable" Value =" True" />
9
+ <Setter Property =" IsTabStop" Value =" False" />
8
10
<Setter Property =" Template" >
9
11
<ControlTemplate >
10
12
<ContentPresenter Name =" PART_ContentPresenter"
Original file line number Diff line number Diff line change @@ -126,11 +126,18 @@ private void UpdatePosition()
126
126
}
127
127
128
128
public ( bool handled , IInputElement ? next ) GetNext ( IInputElement element , NavigationDirection direction ) {
129
+ // If current element isn't this popup host - ignoring
129
130
if ( ! element . Equals ( this ) ) {
130
131
return ( false , null ) ;
131
132
}
132
- var focusable = this . GetVisualDescendants ( ) . OfType < IInputElement > ( ) . FirstOrDefault ( visual => visual . Focusable ) ;
133
- return ( true , focusable ) ;
133
+
134
+ // Finding the focusable descendant
135
+ var focusable = this . GetVisualDescendants ( )
136
+ . OfType < IInputElement > ( )
137
+ . FirstOrDefault ( visual => visual . Focusable ) ;
138
+
139
+ // Or returning the control itself to prevent focus escaping
140
+ return ( true , focusable ?? this ) ;
134
141
}
135
142
136
143
/// <inheritdoc />
You can’t perform that action at this time.
0 commit comments