RetainerBox DrawSelectionAndHoverOutline SelectionZone Incorrect in DesignerView

Hi, Unreal Engine Support.

When I use a RetainerBox to package a CanvasPanel or a Widget, I found that the child widget in RetainerBox draw incorret SelectionOuline ,if not in full screen mode, it more obvious. UE4 engine version is 4.23.

After reading the UE4 4.23 source code,
SDesignerView.cpp →
DrawSelectionAndHoverOutline →
line 32 in FDesignTimeUtils.cpp FSlateApplication::Get().FindWidgetWindow(Widget)
do not find correct CurrentWindowRef.

Because SRetainerWidget new a SVirtualWindow in Construct, the function FSlateApplication::Get().FindWidgetWindow(Widget) should return the editor window, but if widget is type of SRetainerWidget, it return the SVirtualWindow in SRetainerWidget. Here is the bug happened.

So I add a bug fix bug this code in function FDesignTimeUtils::GetArrangedWidgetRelativeToWindow, the bug fix.

bool FDesignTimeUtils::GetArrangedWidgetRelativeToWindow(TSharedRef<SWidget> Widget, FArrangedWidget& ArrangedWidget)
	TSharedPtr<SWindow> WidgetWindow = FSlateApplication::Get().FindWidgetWindow(Widget);
	if ( !WidgetWindow.IsValid() )
		return false;

	// fix RetainerBox find window incorrect
		TSharedRef<SWidget> CurrentWidget = WidgetWindow->GetParentWidget().ToSharedRef();
		TSharedPtr<SWindow> ParentWidgetWindow = FSlateApplication::Get().FindWidgetWindow(CurrentWidget);
			WidgetWindow = ParentWidgetWindow;
	// end fix RetainerBox find window incorrect

	TSharedRef<SWindow> CurrentWindowRef = WidgetWindow.ToSharedRef();

	FWidgetPath WidgetPath;
	if ( FSlateApplication::Get().GeneratePathToWidgetUnchecked(Widget, WidgetPath) )
		ArrangedWidget = WidgetPath.FindArrangedWidget(Widget).Get(FArrangedWidget::GetNullWidget());
		return true;

	return false;


We’ve recently made a switch to a new bug reporting method using a more structured form. Please visit the link below for more details and report the issue using the new Bug Submission Form. Feel free to continue to use this thread for community discussion around the issue.