Skip to content

fix(combobox): Implement ComboBoxHelper.KeepInteriorCornersSquare - #26583

Open
MartinZikmund wants to merge 2 commits into
masterfrom
dev/mazi/comboboxhelper
Open

MartinZikmund wants to merge 2 commits into
masterfrom
dev/mazi/comboboxhelper

Conversation

@MartinZikmund

@MartinZikmund MartinZikmund commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

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 ComboBox style already sets primitives:ComboBoxHelper.KeepInteriorCornersSquare="True", but on Uno the attached property was a [NotImplemented] stub, so it did nothing. This ports WinUI's ComboBoxHelper (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.Convert becomes internal so 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

  • Compile: Uno.UI.UnitTests and SamplesApp (net11.0-desktop).
  • Runtime (Skia desktop): the new Given_ComboBox.When_IsEditable_DropDownOpen_InteriorCornersSquare fails on master (corners never update) and passes here. Given_ComboBox overall: 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 against master. Allocations are UI-thread bytes and exact: a master-vs-master null 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.

Scenario Allocated per iteration Δ alloc Per unit Time per iteration (median) Δ time Null drift
100 editable ComboBoxes, built + laid out 78,312,070 → 78,399,554 B +0.11% +875 B 438.02 → 343.46 ms −21.6% (noise) ±12.2%
Editable ComboBox drop-down open/close × 10 800,336 → 825,650 B +3.16% +2.5 KB 6.65 → 5.67 ms −14.8% (noise) ±42.9%
Mixed page: 40 × 7 Fluent controls 90,444,912 → 90,451,956 B +0.01% +25 B 428.73 → 380.24 ms −11.3% (noise) ±3.1%
200k Tag set/get 0 → 0 B 0 — 20.21 → 24.30 ms +20.2% (noise) ±6.1%

This 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 ✅

🤖 Generated with Claude Code

https://claude.ai/code/session_01TXMNu1LMuUpziGZWHVDmpX

Copilot AI balanced review requested due to automatic review settings November 18, 2026 10:55
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 24s —— View job


PR review: ComboBoxHelper.KeepInteriorCornersSquare

Verdict: ship after minor fixes (review by inspection only; I did not build or run tests).

Severity Count
Medium 1 (stale deferred callback can re-square corners after close)
Low 1 (missing open-up and race test coverage)
Nit 1 (unrelated reorder in CornerRadiusFilterConverter)

Cross-cutting notes

  • The port follows the WinUI structure (.mux.cs, .h.mux.cs, .uno.cs) and uses the standard Generated/ stub-hiding pattern. The attached property and revoker lifecycle, including the weak reference and immediate disposal, look sound.
  • Commit and PR title follow Conventional Commits.
  • The PR description reports a fail-before/pass-after runtime test, which is the right evidence for a bug fix.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@mergify

mergify Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request

// Use dispatcher to make sure we get correct VerticalOffset.
if (DispatcherQueue.GetForCurrentThread() is { } dispatcherQueue)
{
_ = dispatcherQueue.TryEnqueue(() => UpdateCornerRadius(comboBox, isDropDownOpen: true));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Suggested change
_ = 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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: swapping the BottomRight/BottomLeft scale lines is a no-op reorder unrelated to this change. Consider reverting to keep the diff focused.

@github-actions

Copy link
Copy Markdown
Contributor

WinAppSDK sync generator drift detected on 9a95bf9

The Uno.WinAppSDKSyncGenerator produced changes that are not committed on this PR.

To apply automatically (PRs from branches in this repo only): comment /apply-sync-gen on this PR and a bot will push chore: Sync generator run to the head branch.

To apply manually (required for PRs from forks):

  1. Download the sync-generator-patch artifact from this run.
  2. In your local checkout of the PR branch:
    git apply sync-generator.patch
    git add -A
    git commit -m "chore: Sync generator run"
    git push
    

Or re-run the generator locally on Windows via build\run-api-sync-tool.cmd.


// 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);
Comment on lines +96 to +104
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;
}
}
@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 247319 found UI Test snapshots differences: skia-linux-screenshots: 460, skia-windows-screenshots: 507

Details
  • skia-linux-screenshots: 460 changed over 2500

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Accessibility_Showcase.png-dark
    • AnimatedVisualsTestbedPage.png-dark
    • AutomationProperties_StructureAndProps.png-dark
    • AutomationProperties_StructureAndProps.png
    • Accessibility_ScreenReader.png-dark
    • AnimatedVisualsTestbedPage.png
    • Border_CornerRadius_BorderThickness.png-dark
    • Border_CornerRadius_BorderThickness.png
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • CheckBox_DisabledInDisabledListView.png-dark
    • CheckBox_DisabledInDisabledListView.png
    • ComboBox_MaxDropdownHeight.png-dark
    • ComboBox_MaxDropdownHeight.png
    • AnimatedBackVisualSourceSamplePage.png-dark
    • AppWindowTitleBar Properties.png
    • AutomationProperties_AutomationId.png-dark
    • AutomationProperties_AutomationId.png
    • BasicAcrylicBrushTest2.png-dark
  • skia-windows-screenshots: 507 changed over 2500

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Accessibility_Showcase.png-dark
    • AutomationProperties_AutomationId.png
    • Border_CornerRadius_BorderThickness.png-dark
    • Border_CornerRadius_BorderThickness.png
    • Accessibility_ScreenReader.png-dark
    • AutomationProperties_AutomationId.png-dark
    • BasicAcrylicBrushTest2.png-dark
    • BasicAcrylicBrushTest2.png
    • Border_CornerRadius_Binding.png-dark
    • Border_CornerRadius_Binding.png
    • BenchmarkDotNet.png-dark
    • BenchmarkDotNet.png
    • CheckBox_DisabledInDisabledListView.png-dark
    • CheckBox_DisabledInDisabledListView.png
    • CompositionNineGridBrush_Source_Changes.png-dark
    • CompositionNineGridBrush_Source_Changes.png
    • CompositionPath.png-dark
    • CompositionPath.png
    • AnimatedBackVisualSourceSamplePage.png-dark
    • AppWindowTitleBar Properties.png-dark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for ComboBoxHelper.KeepInteriorCornersSquare

5 participants