Skip to content

Commit 6e9b1ff

Browse files
authored
Merge pull request #20110 from unoplatform/dev/mazi/carets-on-top
feat: Propagate `Popup` `ZIndex` to `PopupPanel`
2 parents 5bcd6ee + 9a3b9aa commit 6e9b1ff

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/Uno.UI/UI/Xaml/Controls/Popup/Popup.WithPopupRoot.cs

+8
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ partial void OnIsOpenChangedPartialNative(bool oldIsOpen, bool newIsOpen)
9191
XamlRoot = WinUICoreServices.Instance.ContentRootCoordinator.Unsafe_IslandsIncompatible_CoreWindowContentRoot?.XamlRoot;
9292
}
9393
#endif
94+
if (this.IsDependencyPropertySet(Canvas.ZIndexProperty))
95+
{
96+
Canvas.SetZIndex(PopupPanel, Canvas.GetZIndex(this));
97+
}
98+
else
99+
{
100+
PopupPanel.ClearValue(Canvas.ZIndexProperty);
101+
}
94102

95103
// It's important for PopupPanel to be visible before the popup is opened so that
96104
// child controls can be IsFocusable, which depends on all ancestors (including PopupPanel)

src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.skia.cs

+4
Original file line numberDiff line numberDiff line change
@@ -1429,6 +1429,8 @@ private sealed class TextBoxCommand(Action action) : ICommand
14291429

14301430
private class CaretWithStemAndThumb : Grid
14311431
{
1432+
private const int DefaultZIndex = 10000; // Very high ZIndex to keep carets on top of other popups.
1433+
14321434
// This is equal to the default system accent color on Windows.
14331435
// This is, however, a constant color that doesn't depend on the
14341436
// current system accent color. Changing the accent color does NOT
@@ -1498,6 +1500,8 @@ public void ShowAt(Point p, XamlRoot xamlRoot)
14981500
XamlRoot = xamlRoot
14991501
};
15001502

1503+
Canvas.SetZIndex(_popup, DefaultZIndex);
1504+
15011505
_popup.HorizontalOffset = p.X;
15021506
_popup.VerticalOffset = p.Y;
15031507
if (!_popup.IsOpen)

0 commit comments

Comments
 (0)