File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,12 @@ public partial class Popup : PopupBase
25
25
26
26
internal bool IsSubMenu { get ; set ; }
27
27
28
+ /// <summary>
29
+ /// In WinUI, Popup has IsTabStop set to true by default.
30
+ /// UWP does not include IsTabStop, but Popup is still focusable.
31
+ /// </summary>
32
+ private protected override bool IsTabStopDefaultValue => true ;
33
+
28
34
/// <summary>
29
35
/// Returns true if the popup should show the light-dismiss overlay with its current configuration, false if not
30
36
/// </summary>
Original file line number Diff line number Diff line change @@ -78,18 +78,27 @@ partial void OnIsOpenChangedPartial(bool oldIsOpen, bool newIsOpen)
78
78
_lastFocusedElement = new WeakReference < UIElement > ( focusedElement ) ;
79
79
_lastFocusState = focusState ;
80
80
}
81
+
82
+ // Give the child focus if allowed
83
+ if ( Child is FrameworkElement fw && fw . AllowFocusOnInteraction )
84
+ {
85
+ Focus ( FocusState . Programmatic ) ;
86
+ }
81
87
}
82
88
83
89
Opened ? . Invoke ( this , newIsOpen ) ;
84
90
}
85
91
else
86
92
{
87
93
_openPopupRegistration ? . Dispose ( ) ;
88
-
89
- if ( _lastFocusedElement != null && _lastFocusedElement . TryGetTarget ( out var target ) )
94
+
95
+ if ( IsLightDismissEnabled )
90
96
{
91
- target . Focus ( _lastFocusState ) ;
92
- _lastFocusedElement = null ;
97
+ if ( _lastFocusedElement != null && _lastFocusedElement . TryGetTarget ( out var target ) )
98
+ {
99
+ target . Focus ( _lastFocusState ) ;
100
+ _lastFocusedElement = null ;
101
+ }
93
102
}
94
103
95
104
Closed ? . Invoke ( this , newIsOpen ) ;
You can’t perform that action at this time.
0 commit comments