Repository navigation
fix(combobox): Implement ComboBoxHelper.KeepInteriorCornersSquare - #26583
MartinZikmund wants to merge 2 commits into
Conversation
Co-Authored-By: Martin Zikmund <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNu1LMuUpziGZWHVDmpX
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNu1LMuUpziGZWHVDmpX
|
Claude finished @MartinZikmund's task in 24s —— View job PR review: ComboBoxHelper.KeepInteriorCornersSquareVerdict: ship after minor fixes (review by inspection only; I did not build or run tests).
Cross-cutting notes
|
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
|
Tick the box to add this pull request to the merge queue (same as
|
| // Use dispatcher to make sure we get correct VerticalOffset. | ||
| if (DispatcherQueue.GetForCurrentThread() is { } dispatcherQueue) | ||
| { | ||
| _ = dispatcherQueue.TryEnqueue(() => UpdateCornerRadius(comboBox, isDropDownOpen: true)); |
There was a problem hiding this comment.
Race (defensive hardening): the deferred callback unconditionally applies the "open" corners. If the drop-down is closed before the queued work runs (e.g. open then immediate close or light-dismiss), OnDropDownClosed restores the corners first and this callback then re-squares them, leaving the TextBox/popup corners stuck in the open state until the next open/close cycle. Consider re-checking state inside the callback:
| _ = dispatcherQueue.TryEnqueue(() => UpdateCornerRadius(comboBox, isDropDownOpen: true)); | |
| _ = dispatcherQueue.TryEnqueue(() => | |
| { | |
| if (comboBox.IsDropDownOpen) | |
| { | |
| UpdateCornerRadius(comboBox, isDropDownOpen: true); | |
| } | |
| }); |
| var textBox = GetEditableText(SUT); | ||
| Assert.AreEqual(new CornerRadius(4), textBox.CornerRadius); | ||
|
|
||
| SUT.IsDropDownOpen = true; |
There was a problem hiding this comment.
Test coverage: only the "opens down" branch is exercised. The open-up branch (Bottom/Top filters swapped) and the open-then-close-immediately race are untested. Consider a second case with the ComboBox bottom-aligned (VerticalAlignment.Bottom) asserting CornerRadius(0, 0, 4, 4) on the TextBox.
| cornerRadius.TopLeft *= scale; | ||
| cornerRadius.TopRight *= scale; | ||
| cornerRadius.BottomLeft *= scale; | ||
| cornerRadius.BottomRight *= scale; |
There was a problem hiding this comment.
Nit: swapping the BottomRight/BottomLeft scale lines is a no-op reorder unrelated to this change. Consider reverting to keep the diff focused.
WinAppSDK sync generator drift detected on
|
|
|
||
| // The ComboBox sits at the top of the window, so the drop-down opens below it. | ||
| Assert.AreEqual(new CornerRadius(4, 4, 0, 0), textBox.CornerRadius); | ||
| Assert.AreEqual(0, popupBorder.CornerRadius.TopLeft); |
| if (comboBox.GetTemplateChild(c_popupBorderName) is Border popupBorder) | ||
| { | ||
| if (comboBox.GetTemplateChild(c_editableTextName) is TextBox textBox) | ||
| { | ||
| var transform = popupBorder.TransformToVisual(textBox); | ||
| var popupTop = transform.TransformPoint(new Point(0, 0)); | ||
| verticalOffset = popupTop.Y; | ||
| } | ||
| } |
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 247319 found UI Test snapshots differences: Details
|
GitHub Issue: closes #16486
PR Type:
🐞 Bugfix
What changed? 🚀
Split out of #24094 (originally by @morning4coffe-dev). It isn't a performance change, so it gets its own PR.
The default Fluent
ComboBoxstyle already setsprimitives:ComboBoxHelper.KeepInteriorCornersSquare="True", but on Uno the attached property was a[NotImplemented]stub, so it did nothing. This ports WinUI'sComboBoxHelper(controls/dev/ComboBox). When an editable ComboBox's drop-down opens, the corners between the text box and the popup are squared, depending on whether the popup opens up or down. The corners are restored when it closes.CornerRadiusFilterConverter.Convertbecomesinternalso the helper can reuse it, as upstream does.Visible change: every editable ComboBox using the default style now squares those corners while open, matching WinUI.
Validation
Uno.UI.UnitTestsand SamplesApp (net11.0-desktop).Given_ComboBox.When_IsEditable_DropDownOpen_InteriorCornersSquarefails onmaster(corners never update) and passes here.Given_ComboBoxoverall: 45 passed, 1 failed, 3 skipped. The failure,When_ComboBox_MinWidth(169.33 vs 170), is the known fractional-DPI rounding issue with runtime tests on this machine's 150% scale, unrelated to this change.Performance
Headless Skia app with Fluent resources (x64, net10.0,
DOTNET_TieredCompilation=0), one process per scenario, 4 interleaved A/B rounds againstmaster. Allocations are UI-thread bytes and exact: amaster-vs-masternull run drifted 0.00%. A time change is bold only when it is larger than that scenario's null drift and the A/B ranges don't overlap; anything else is marked noise. Background load on the machine made some timings noisy.ComboBoxes, built + laid outComboBoxdrop-down open/close × 10Tagset/getThis is a behaviour fix, not an optimization, so the table shows its cost. Each editable ComboBox allocates +875 B (the drop-down event subscriptions and their revoker), and each open/close of an editable ComboBox +2.5 KB (the dispatched corner-radius update). Non-editable ComboBoxes and the rest of the mixed page are unaffected (+25 B per control is noise-level).
PR Checklist ✅
Screenshots Compare Test Runresults.🤖 Generated with Claude Code
https://claude.ai/code/session_01TXMNu1LMuUpziGZWHVDmpX