Repository: unoplatform/uno
File: src/Uno.UI/UI/Xaml/Controls/FocusVisual/SystemFocusVisual.cs (C#)

Code before:
			focusVisual.SetLayoutProperties();
			var parentViewport = element.GetParentViewport(); // the parent Viewport is used, similar to PropagateEffectiveViewportChange
			focusVisual.ApplyClipping(parentViewport.Effective);

			focusVisual._focusedElementSubscriptions.Disposable = Disposable.Create(() =>
			{
				element.SizeChanged -= focusVisual.FocusedElementSizeChanged;
#if !UNO_HAS_ENHANCED_LIFECYCLE
				element.LayoutUpdated -= focusVisual.FocusedElementLayoutUpdated;
#endif
				element.EffectiveViewportChanged -= focusVisual.FocusedElementEffectiveViewportChanged;
				element.UnregisterPropertyChangedCallback(VisibilityProperty, visibilityToken);

				focusVisual.DetachVisualPartial();
			});
#endif
		}
	}

#if __SKIA__
	private void OnFrameRendered()
	{
		if (XamlRoot is null ||
			FocusedElement is null ||
			FocusedElement.Visibility == Visibility.Collapsed ||
			(FocusedElement is Control control && !control.IsEnabled && !control.AllowFocusWhenDisabled))
		{
			Visibility = Visibility.Collapsed;
			return;
		}

		var parentElement = VisualTreeHelper.GetParent(FocusedElement) as UIElement;
		if (parentElement is null)
		{
			Visibility = Visibility.Collapsed;
			return;
		}

		Visibility = Visibility.Visible;

		var transform = GetTransform(FocusedElement, XamlRoot.VisualTree.RootElement);

		var totalClipRect = FocusedElement.Visual.GetTotalClipPath(true).Bounds;
		var inverseMatrix = transform.Inverse();
		var topLeft = inverseMatrix.Transform(new Point(totalClipRect.Left, totalClipRect.Top));
		var topRight = inverseMatrix.Transform(new Point(totalClipRect.Right, totalClipRect.Top));
		var bottomLeft = inverseMatrix.Transform(new Point(totalClipRect.Left, totalClipRect.Bottom));
		var bottomRight = inverseMatrix.Transform(new Point(totalClipRect.Right, totalClipRect.Bottom));

		var minX = Math.Min(Math.Min(topLeft.X, topRight.X), Math.Min(bottomLeft.X, bottomRight.X));
		var maxX = Math.Max(Math.Max(topLeft.X, topRight.X), Math.Max(bottomLeft.X, bottomRight.X));

Review comment (suggestion):
```suggestion
			FocusedElement is not Control { IsEnabled: true, AllowFocusWhenDisabled: true} control)
```

Code after:
			element.Unloaded += focusVisual.FocusedElementUnloaded;

			var visibilityToken = element.RegisterPropertyChangedCallback(VisibilityProperty, focusVisual.FocusedElementVisibilityChanged);

			focusVisual.AttachVisualPartial();

			focusVisual.SetLayoutProperties();
			var parentViewport = element.GetParentViewport(); // the parent Viewport is used, similar to PropagateEffectiveViewportChange
			focusVisual.ApplyClipping(parentViewport.Effective);

			focusVisual._focusedElementSubscriptions.Disposable = Disposable.Create(() =>
			{
				element.SizeChanged -= focusVisual.FocusedElementSizeChanged;
#if !UNO_HAS_ENHANCED_LIFECYCLE
				element.LayoutUpdated -= focusVisual.FocusedElementLayoutUpdated;
#endif
				element.EffectiveViewportChanged -= focusVisual.FocusedElementEffectiveViewportChanged;
				element.UnregisterPropertyChangedCallback(VisibilityProperty, visibilityToken);

				focusVisual.DetachVisualPartial();
			});
#endif
		}
	}

#if __SKIA__
	private void OnFrameRendered()
	{
		if (XamlRoot is null ||
			FocusedElement is null ||
			FocusedElement.Visibility == Visibility.Collapsed ||
			FocusedElement is Control { IsEnabled: false, AllowFocusWhenDisabled: false })
		{
			Visibility = Visibility.Collapsed;
			return;
		}

		if (VisualTreeHelper.GetParent(FocusedElement) is not UIElement)
		{
			Visibility = Visibility.Collapsed;
			return;
		}

		var transform = GetTransform(FocusedElement, XamlRoot.VisualTree.RootElement);

		FocusedElement.Visual.GetTotalClipPath(_spareRenderPath, true);
		var totalClipRect = _spareRenderPath.Bounds;
		var inverseMatrix = transform.Inverse();
		var topLeft = inverseMatrix.Transform(new Point(totalClipRect.Left, totalClipRect.Top));
		var topRight = inverseMatrix.Transform(new Point(totalClipRect.Right, totalClipRect.Top));
		var bottomLeft = inverseMatrix.Transform(new Point(totalClipRect.Left, totalClipRect.Bottom));