Skip to content

fix(automation): Pass owner to LoopingSelectorItem peer - #26231

Merged
MartinZikmund merged 3 commits into
masterfrom
dev/doti/peers-sel-24183
Nov 9, 2026
Merged

MartinZikmund merged 3 commits into
masterfrom
dev/doti/peers-sel-24183

Conversation

@morning4coffe-dev

Copy link
Copy Markdown
Member

GitHub Issue: closes #24183

PR Type:

🐞 Bugfix

What changed? 🚀

Opening a DatePicker or TimePicker flyout with an automation client attached threw a NullReferenceException for every looping selector item, so screen readers couldn't see any of the picker values.

Two problems, one hiding the other:

  • LoopingSelectorItemAutomationPeer never got its owner. The constructor didn't chain to base(owner), so Owner stayed null and the first property read threw. WinUI creates it with CreateInstanceWithOwner (LoopingSelectorItemAutomationPeer_Partial.cpp, InitializeImpl).
  • Once the owner was set, GetName() hit a stub. DatePickerFlyoutItem.GetStringRepresentation threw NotImplementedException. I ported it 1:1 from DatePickerFlyoutItem_Partial.cpp, together with the rest of its ICustomPropertyProvider surface (GetCustomProperty / GetIndexedProperty return null, Type returns the type, ToString delegates to GetStringRepresentation). The generated stub was adjusted the same way the API sync tool does it.

Test: Given_TimePicker.When_Flyout_Opened_Then_LoopingSelectorItem_Peers_Have_Owner opens the flyout and checks every item peer has an owner and a name. It's pinned to a 12-hour clock so it doesn't depend on the machine's culture.

Checked with a UIA client on Skia Desktop: master exposes no picker items at all after opening the TimePicker flyout; with this change it exposes all 33, named "12", "1", ….

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 14s —— View job


Review summary

  • Read the PR diff and the surrounding peer code

Verdict: ship. No blocking issues found, and I posted no inline comments.

Issues by severity: 0 blocker, 0 major, 0 minor.

I read the diff and the surrounding code. I did not build the project or run the tests.

  • Root cause: Chaining base(pOwner) fixes the null Owner at its source, not with a null guard. It matches WinUI's CreateInstanceWithOwner. The commented-out port code in InitializeImpl confirms that call was the missing step.
  • DatePickerFlyoutItem: The port of GetStringRepresentation, GetCustomProperty, GetIndexedProperty and Type follows DatePickerFlyoutItem_Partial.cpp. The Generated/ stub was edited, which AGENTS.md normally forbids. Here it is the "Skipping already declared" form the API sync tool produces, and the PR description says it was done that way on purpose. Make sure the next sync run produces the same output.
  • Test: The runtime test covers the regression: owner, name, control type and the SelectionItem pattern. Pinning the 12-hour clock keeps it culture-independent. It has no skip or ignore attributes, so there is nothing to flag there.
  • Style: Tabs, braces and MUX headers are fine. No event Action was added. The PR title follows Conventional Commits.

Non-blocking: The red-before/green-after run isn't shown in the PR. The description's UIA-client check on Skia Desktop (master exposes no items, the PR exposes 33) partly covers it.

@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 14s —— View job


Review summary

  • Read the PR diff against origin/master
  • Checked the follow-up commit against the earlier code-quality comments

Verdict: ship. I found no blocking issues and posted no inline comments.

Issues by severity: 0 blocker, 0 major, 0 minor.

I read the diff and did not build the project or run the tests.

  • Earlier code-quality comments: The latest commit resolves both. The loop now uses panel.Children.Cast<LoopingSelectorItem>(). The peer is obtained with an is not ... peer pattern guard, so the null dereference warning goes away. In the test this guard runs inside a lambda, so the return after Assert.Fail only exits the lambda. That is fine, because Assert.Fail throws.
  • Root cause: Chaining : base(pOwner) fixes the null Owner at the source rather than guarding the reads. The comment explaining that it replaces CreateInstanceWithOwner is short and useful.
  • DatePickerFlyoutItem: The port is faithful to DatePickerFlyoutItem_Partial.cpp. It includes the MUX header, braces, and tabs. ToString() now delegates to GetStringRepresentation(), so there is no duplicated logic.
  • Generated/ stub edit: AGENTS.md normally forbids editing Generated/. Here the stub was changed to the "already declared" form that the API sync tool produces. Confirm the next sync run produces the same output.
  • Test: The runtime test has no skip or [Ignore] attributes. Pinning the 12-hour clock keeps it culture-independent. Flyout cleanup is in a finally block.

Non-blocking: The PR doesn't show a red-before, green-after test run. The UIA-client check in the description (master exposes no items, this PR exposes 33) partly covers that gap.

@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 244693 found UI Test snapshots differences: skia-linux-screenshots: 222, skia-windows-screenshots: 282

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

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AutomationProperties_StructureAndProps.png-dark
    • AutomationProperties_StructureAndProps.png
    • Border_CornerRadius_BorderThickness.png-dark
    • Border_CornerRadius_BorderThickness.png
    • AnimatedVisualsTestbedPage.png
    • AppWindowTitleBar Properties.png
    • Border_CornerRadius_Binding.png-dark
    • Border_CornerRadius_Binding.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • AutomationProperties_AutomationId.png-dark
    • AutomationProperties_AutomationId.png
    • Basics.png-dark
    • Basics.png
    • BenchmarkDotNet.png-dark
    • BenchmarkDotNet.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
  • skia-windows-screenshots: 282 changed over 2494

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

@MartinZikmund
MartinZikmund merged commit fd09d41 into master Nov 9, 2026
52 checks passed
@MartinZikmund
MartinZikmund deleted the dev/doti/peers-sel-24183 branch November 9, 2026 13:40
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.

LoopingSelectorItemAutomationPeer is constructed without its owner, throwing NullReferenceException for every picker item

4 participants