Skip to content

fix(automation): Default AutomationProperties strings to empty - #26233

Merged
MartinZikmund merged 2 commits into
masterfrom
dev/doti/peers-props-string-defaults
Nov 10, 2026
Merged

MartinZikmund merged 2 commits into
masterfrom
dev/doti/peers-props-string-defaults

Conversation

@morning4coffe-dev

Copy link
Copy Markdown
Member

GitHub Issue: closes #25260

PR Type:

🐞 Bugfix

What changed? 🚀

Eight string attached properties on AutomationProperties were registered with a null default: AcceleratorKey, AccessKey, FullDescription, HelpText, ItemStatus, ItemType, LocalizedControlType and LocalizedLandmarkType. On WinUI an unset string property reads as an empty string (they're declared as String with no default in StaticMetadata.g.cpp, and the getters in AutomationProperties.cpp just return the stored value), so AutomationProperties.GetHelpText(element) gave "" there and null here.

They now default to string.Empty.

I went through every consumer of these properties: the peers, AriaMapper, the WASM semantic DOM, the Win32 / macOS / iOS / Android bridges, AccessKeyStringBuilder and CommandingHelpers. They all already use IsNullOrEmpty or ?? "", so nothing in Uno behaves differently except the returned value.

Behavior change: app code that compares these getters to null will now see "", the same as on WinUI.

Tests: Given_AutomationPropertiesDefaults checks both the attached property getters and the values a default peer returns.

PR Checklist ✅

🤖 Generated with Claude Code

@morning4coffe-dev morning4coffe-dev self-assigned this Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @morning4coffe-dev's task in 22s —— View job


Review summary

Verdict: ship. No blocking issues.

Issues: 0 high, 0 medium, 1 low (inline nit on test coverage).

Code review assessment (by inspection only, nothing built or run):

  • The change is minimal and correct. Eight AutomationProperties string DPs now default to string.Empty, which matches the existing AutomationId and Name registrations. The OnLocalizedLandmarkTypeChanged callback is still wired.
  • I grepped the consumers that read these getters. They use IsNullOrEmpty, NullIfEmpty, GetNonEmpty or ?? string.Empty:
    • the peers and HyperlinkAutomationPeer
    • AriaMapper and the WASM accessibility code
    • the Win32 and Android bridges
    • CommandingHelpers
    • FrameworkElement
  • I found no consumer that depends on null, so the PR's claim of no internal behavior change holds.
  • Runtime tests cover both the attached getters and the default peer values.

Cross-cutting notes:

  • The PR checklist says "NO breaking changes", but the description lists a behavior change: code that compares these getters to null now sees "". That change matches WinUI, so it is justified. The checklist item is slightly inconsistent with the description, and a short release note might be worth adding.
  • Compile and runtime validation were not performed here. Suggested command for maintainers: /runtime-tests Given_AutomationPropertiesDefaults.

Assert.AreEqual(string.Empty, peer.GetItemStatus(), "ItemStatus");
Assert.AreEqual(string.Empty, peer.GetItemType(), "ItemType");
Assert.AreEqual(string.Empty, peer.GetLocalizedLandmarkType(), "LocalizedLandmarkType");
}

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 (low): the tests only cover the unset state. Since the point is WinUI parity, consider adding one case that sets a value and then ClearValues it (or sets null explicitly) and asserts the resulting getter value. That would show the default is restored as "" and would pin down what an explicit null returns. LocalizedControlType is also absent from the peer test, probably because the peer falls back to the control-type string, but a one-line comment saying so would help the next reader.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added When_String_Properties_Are_Cleared_Then_Empty_String_Is_Returned (6f163a0). It sets and then clears all eight properties with ClearValue.

I left out an explicit SetValue(null) case on purpose. WinUI turns a null HSTRING into "", while Uno stores null there, and that's a separate parity gap from the default this PR fixes. I also added the comment about LocalizedControlType falling back to the control type name.

@unodevops

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @morning4coffe-dev's task in 12s —— View job


Review summary

Verdict: ship. No blocking issues.

Issues: 0 high, 0 medium, 0 low.

Code review (by inspection only, nothing built or run):

  • The eight string DPs (AcceleratorKey, AccessKey, FullDescription, HelpText, ItemStatus, ItemType, LocalizedControlType, LocalizedLandmarkType) now default to string.Empty. This matches the existing AutomationId and Name registrations. The OnLocalizedLandmarkTypeChanged callback is still wired.
  • The earlier review's nit is addressed in the latest push:
    • When_String_Properties_Are_Cleared_Then_Empty_String_Is_Returned covers set followed by ClearValue.
    • A comment in the peer test explains why LocalizedControlType is left out.
  • The tests are runtime tests in Uno.UI.RuntimeTests with [RunsOnUIThread]. None are ignored or skipped.

Cross-cutting notes:

  • The PR checklist says "NO breaking changes", but the description lists a behavior change: code that compares these getters to null now sees "". That change matches WinUI, so it is justified. A short release note might still be worth adding.
  • Compile and runtime validation were not performed here. Suggested command for maintainers: /runtime-tests Given_AutomationPropertiesDefaults.

@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 244694 found UI Test snapshots differences: skia-linux-screenshots: 226, skia-windows-screenshots: 296

Details
  • skia-linux-screenshots: 226 changed over 2494

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ClipboardTests.png-dark
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • AppWindowTitleBar Properties.png-dark
    • BasicAcrylicBrushTest.png-dark
    • BasicAcrylicBrushTest.png
    • Border_CornerRadius_BorderThickness.png-dark
    • Border_CornerRadius_BorderThickness.png
    • ComboBox_MaxDropdownHeight.png-dark
    • ComboBox_MaxDropdownHeight.png
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • AppWindowTitleBar Properties.png
    • AutomationProperties_StructureAndProps.png-dark
    • AutomationProperties_StructureAndProps.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • AnimatedBackVisualSourceSamplePage.png
  • skia-windows-screenshots: 296 changed over 2494

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedBackVisualSourceSamplePage.png
    • Basics.png-dark
    • Basics.png
    • Buttons.png-dark
    • Buttons.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • AnimatedBackVisualSourceSamplePage.png-dark
    • AnimatedVisualsTestbedPage.png-dark
    • AutomationProperties_StructureAndProps.png-dark
    • AutomationProperties_StructureAndProps.png
    • BenchmarkDotNet.png-dark
    • BenchmarkDotNet.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • AutomationProperties_AutomationId.png-dark
    • BasicAcrylicBrushTest.png-dark
    • BasicAcrylicBrushTest.png

@morning4coffe-dev
morning4coffe-dev force-pushed the dev/doti/peers-props-string-defaults branch from 6f163a0 to 8433629 Compare November 9, 2026 21:25
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @morning4coffe-dev's task in 11s —— View job


Review summary

Verdict: ship. No blocking issues.

Issues: 0 high, 0 medium, 0 low.

Code review (by inspection only; nothing built or run):

  • The eight string DPs (AcceleratorKey, AccessKey, FullDescription, HelpText, ItemStatus, ItemType, LocalizedControlType, LocalizedLandmarkType) now default to string.Empty. This matches the existing AutomationId and Name registrations, and the change callbacks are unchanged.
  • The runtime tests cover the unset attached getters, the default peer values, and set followed by ClearValue. The comment explaining why LocalizedControlType is left out of the peer test is present.
  • Both new tests use [RunsOnUIThread], and none are ignored or skipped.

Cross-cutting notes:

  • The checklist says "NO breaking changes", but the description lists a behavior change: code that compares these getters to null now sees "". That matches WinUI, so it is justified, but a short release note could help.
  • The explicit SetValue(null) case is deliberately left out of this PR. WinUI turns null into "" and Uno stores null, so that parity gap deserves a separate issue.
  • The screenshot-compare run reports hundreds of differences (226 on Linux, 296 on Windows) across unrelated samples such as Buttons and ClipboardTests. This change should not alter rendering, so it looks like baseline noise, but someone should confirm it before merge. The AutomationProperties_StructureAndProps sample is among the changed ones and is worth checking.
  • Compile and runtime validation were not performed here. Suggested command for maintainers: /runtime-tests Given_AutomationPropertiesDefaults.

@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 244947 found UI Test snapshots differences: skia-linux-screenshots: 236, skia-windows-screenshots: 309

Details
  • skia-linux-screenshots: 236 changed over 2494

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedVisualsTestbedPage.png
    • AutomationProperties_AutomationId.png
    • BasicAcrylicBrushTest2.png-dark
    • BasicAcrylicBrushTest2.png
    • Border_CornerRadius_Binding.png-dark
    • Border_CornerRadius_Binding.png
    • Border_CornerRadius_BorderThickness.png-dark
    • Border_CornerRadius_BorderThickness.png
    • Buttons.png-dark
    • Buttons.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • CompositionPath.png-dark
    • CompositionPath.png
    • BasicAcrylicBrushTest.png-dark
    • BasicAcrylicBrushTest.png
    • Basics.png-dark
    • Basics.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
  • skia-windows-screenshots: 309 changed over 2494

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedVisualsTestbedPage.png
    • AnimatedBackVisualSourceSamplePage.png-dark
    • AnimatedBackVisualSourceSamplePage.png
    • BasicAcrylicBrushTest2.png-dark
    • BasicAcrylicBrushTest2.png
    • Basics.png-dark
    • Basics.png
    • BenchmarkDotNet.png-dark
    • BenchmarkDotNet.png
    • Border_CornerRadius_BorderThickness.png-dark
    • ButtonClippingTestsControl.png-dark
    • Border_CornerRadius_BorderThickness.png
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • ContentPresenter_NativeEmbedding.png-dark
    • ContentPresenter_NativeEmbedding.png
    • CompositionPath.png-dark
    • CompositionPath.png
    • AutomationProperties_StructureAndProps.png-dark

@MartinZikmund
MartinZikmund merged commit 971a4aa into master Nov 10, 2026
50 of 52 checks passed
@MartinZikmund
MartinZikmund deleted the dev/doti/peers-props-string-defaults branch November 10, 2026 08:59
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.

AutomationProperties string attached properties (HelpText, AcceleratorKey, ...) default to null instead of an empty string

4 participants