diff --git a/DialogHost.Avalonia/DialogOverlayPopupHost.axaml b/DialogHost.Avalonia/DialogOverlayPopupHost.axaml index 3e714ac..47b4f99 100644 --- a/DialogHost.Avalonia/DialogOverlayPopupHost.axaml +++ b/DialogHost.Avalonia/DialogOverlayPopupHost.axaml @@ -5,6 +5,8 @@ TargetType="dialogHost:DialogOverlayPopupHost"> + + ().FirstOrDefault(visual => visual.Focusable); - return (true, focusable); + + // Finding the focusable descendant + var focusable = this.GetVisualDescendants() + .OfType() + .FirstOrDefault(visual => visual.Focusable); + + // Or returning the control itself to prevent focus escaping + return (true, focusable ?? this); } ///