Skip to content

chore: Improve Win32 automation pattern support - #23276

Merged
morning4coffe-dev merged 18 commits into
masterfrom
dev/doti/gi-si-automation
May 18, 2026
Merged

morning4coffe-dev merged 18 commits into
masterfrom
dev/doti/gi-si-automation

Conversation

@morning4coffe-dev

Copy link
Copy Markdown
Member

GitHub Issue: closes #

PR Type:

🐞 Bugfix

What changed? 🚀

PR Checklist ✅

Copilot AI review requested due to automatic review settings May 17, 2026 11:16
@github-actions github-actions Bot added the area/automation Categorizes an issue or PR as relevant to project automation label May 17, 2026

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.

Pull request overview

This PR expands Uno’s Win32 UI Automation (UIA) parity with WinUI by adding missing automation peers/patterns, improving popup/flyout UIA tree shaping, and wiring additional UIA COM pattern IDs/wrappers for the Skia Win32 host.

Changes:

  • Add/override OnCreateAutomationPeer() across multiple controls and introduce several new automation peers (Popup, Pivot, ToolTip, SplitView overlays, etc.).
  • Implement minimal TextPattern support via DirectUI.TextAdapter/TextRangeAdapter and bridge additional UIA pattern IDs through the Win32 provider layer.
  • Improve Win32 UIA tree navigation/caching (synthetic pane nodes, template-part hit-test promotion, provider-owner resolution for virtual/data peers) and add FormatMessage-style string substitution (StringUtil.FormatMsg) with tests.

Reviewed changes

Copilot reviewed 77 out of 85 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/Uno.UI/UI/Xaml/FrameworkElement.cs Promote named/labeled FrameworkElements into UIA tree
src/Uno.UI/UI/Xaml/Controls/WebView/WebView2/WebView2.cs Add WebView2 automation peer creation
src/Uno.UI/UI/Xaml/Controls/ToolTip/ToolTip.cs Add ToolTip automation peer creation
src/Uno.UI/UI/Xaml/Controls/TitleBar/TitleBarAutomationPeer.cs Implement TitleBarAutomationPeer (new)
src/Uno.UI/UI/Xaml/Controls/TimePicker/TimePicker.partial.mux.cs Use FormatMsg for UIA name formatting
src/Uno.UI/UI/Xaml/Controls/SplitButton/SplitButtonAutomationPeer.cs Surface flyout presenter as UIA child (Uno-specific)
src/Uno.UI/UI/Xaml/Controls/SplitButton/SplitButton.cs Raise structure-changed UIA event on flyout open/close
src/Uno.UI/UI/Xaml/Controls/RichTextBlock/RichTextBlockOverflow.cs Add RichTextBlockOverflow peer creation
src/Uno.UI/UI/Xaml/Controls/RichTextBlock/RichTextBlock.cs Add RichTextBlock peer creation
src/Uno.UI/UI/Xaml/Controls/RichEditBox/RichEditBox.cs Add RichEditBox peer creation
src/Uno.UI/UI/Xaml/Controls/RadioButtons/RadioButtons.cs Add RadioButtons peer creation
src/Uno.UI/UI/Xaml/Controls/Primitives/LoopingSelector/LoopingSelectorAutomationPeer_Partial.cs Simplify/correct data peer caching logic
src/Uno.UI/UI/Xaml/Controls/Popup/PopupPanel.cs Delegate PopupPanel peer creation to Popup
src/Uno.UI/UI/Xaml/Controls/Popup/Popup.cs Add Popup automation peer creation
src/Uno.UI/UI/Xaml/Controls/Pivot/PivotItem.cs Add PivotItem peer creation
src/Uno.UI/UI/Xaml/Controls/Pivot/Pivot.cs Add Pivot peer creation
src/Uno.UI/UI/Xaml/Controls/MenuBar/MenuBar.cs Add MenuBar peer creation
src/Uno.UI/UI/Xaml/Controls/MediaPlayerElement/MediaTransportControls.cs Add MediaTransportControls peer creation
src/Uno.UI/UI/Xaml/Controls/MediaPlayerElement/MediaPlayerElement.cs Add MediaPlayerElement peer creation
src/Uno.UI/UI/Xaml/Controls/ListViewBase/ListViewBase.cs Add ListViewBase peer creation
src/Uno.UI/UI/Xaml/Controls/ListView/ListViewHeaderItem.cs Add ListViewHeaderItem peer creation
src/Uno.UI/UI/Xaml/Controls/ListView/ListView.cs Add ListView peer creation
src/Uno.UI/UI/Xaml/Controls/ListBox/ListBoxItem.cs Add ListBoxItem peer creation (new partial)
src/Uno.UI/UI/Xaml/Controls/ListBox/ListBox.cs Add ListBox peer creation (new partial)
src/Uno.UI/UI/Xaml/Controls/GroupItem.Partial.cs Add GroupItem peer creation
src/Uno.UI/UI/Xaml/Controls/GridView/GridViewItem.cs Add GridViewItem peer creation
src/Uno.UI/UI/Xaml/Controls/GridView/GridViewHeaderItem.cs Add GridViewHeaderItem peer creation
src/Uno.UI/UI/Xaml/Controls/Flyout/FlyoutPresenter.cs Track owning FlyoutBase + presenter peer + plain text
src/Uno.UI/UI/Xaml/Controls/Flyout/FlyoutBase.cs Wire FlyoutPresenter owner back-reference
src/Uno.UI/UI/Xaml/Controls/DatePicker/DatePickerFlyoutPresenterAutomationPeer.cs Fix peer ctor to take owner
src/Uno.UI/UI/Xaml/Controls/DatePicker/DatePickerFlyoutPresenter_Partial.cs Add DatePickerFlyoutPresenter peer creation
src/Uno.UI/UI/Xaml/Controls/DatePicker/DatePicker.cs Add DatePicker peer + UIA name formatting
src/Uno.UI/UI/Xaml/Controls/ComboBox/ComboBox.custom.cs Expose popup/editable parts for automation
src/Uno.UI/UI/Xaml/Controls/CalendarView/CalendarViewAutomationPeer.cs Implement Table/Grid/Value/Selection providers
src/Uno.UI/UI/Xaml/Controls/AutoSuggestBox/AutoSuggestBox.cs Add AutoSuggestBox peer creation
src/Uno.UI/UI/Xaml/Automation/Peers/ToolTipAutomationPeer.cs Implement ToolTipAutomationPeer (new)
src/Uno.UI/UI/Xaml/Automation/Peers/TextBoxAutomationPeer.cs Add Text/Text2/TextEdit pattern support
src/Uno.UI/UI/Xaml/Automation/Peers/TextBlockAutomationPeer.cs Add Text2 pattern support
src/Uno.UI/UI/Xaml/Automation/Peers/SplitViewPaneAutomationPeer.cs Implement SplitView pane window pattern (new)
src/Uno.UI/UI/Xaml/Automation/Peers/SplitViewLightDismissAutomationPeer.cs Implement SplitView light-dismiss invoke (new)
src/Uno.UI/UI/Xaml/Automation/Peers/RichEditBoxAutomationPeer.cs Add Text patterns + ValueProvider + naming fallbacks
src/Uno.UI/UI/Xaml/Automation/Peers/RadioButtonAutomationPeer.cs Match WinUI pattern exposure (SelectionItem only)
src/Uno.UI/UI/Xaml/Automation/Peers/PopupAutomationPeer.cs Implement PopupAutomationPeer + Window pattern (new)
src/Uno.UI/UI/Xaml/Automation/Peers/PivotItemDataAutomationPeer.cs Add Pivot item data peer (new)
src/Uno.UI/UI/Xaml/Automation/Peers/PivotItemAutomationPeer.cs Add PivotItemAutomationPeer (new)
src/Uno.UI/UI/Xaml/Automation/Peers/PivotAutomationPeer.cs Add PivotAutomationPeer (new)
src/Uno.UI/UI/Xaml/Automation/Peers/PasswordBoxAutomationPeer.cs Add Text patterns + masked ValueProvider
src/Uno.UI/UI/Xaml/Automation/Peers/NamedContainerAutomationPeer.cs Add NamedContainerAutomationPeer (new)
src/Uno.UI/UI/Xaml/Automation/Peers/MediaTransportControlsAutomationPeer.cs Add MediaTransportControlsAutomationPeer (new)
src/Uno.UI/UI/Xaml/Automation/Peers/MediaPlayerElementAutomationPeer.cs Add MediaPlayerElementAutomationPeer (new)
src/Uno.UI/UI/Xaml/Automation/Peers/ListViewItemDataAutomationPeer.cs Add ListViewItemDataAutomationPeer (new)
src/Uno.UI/UI/Xaml/Automation/Peers/ListViewBaseItemAutomationPeer.mux.cs Add shared list base item peer (new)
src/Uno.UI/UI/Xaml/Automation/Peers/ListViewBaseItemAutomationPeer.h.mux.cs Add list base item peer header stub (new)
src/Uno.UI/UI/Xaml/Automation/Peers/HyperlinkButtonAutomationPeer.cs Add Invoke pattern exposure
src/Uno.UI/UI/Xaml/Automation/Peers/HyperlinkAutomationPeer.cs Add Hyperlink automation peer (new)
src/Uno.UI/UI/Xaml/Automation/Peers/GridViewItemDataAutomationPeer.cs Add GridViewItemDataAutomationPeer (new)
src/Uno.UI/UI/Xaml/Automation/Peers/FrameworkElementAutomationPeer.cs Default control type initialization
src/Uno.UI/UI/Xaml/Automation/Peers/FlyoutPresenterAutomationPeer.cs Resolve owning flyout via back-reference
src/Uno.UI/UI/Xaml/Automation/Peers/DatePickerAutomationPeer.cs Implement naming fallback to Header/localized string
src/Uno.UI/UI/Xaml/Automation/Peers/ComboBoxLightDismissAutomationPeer.cs Add ComboBox light-dismiss peer (new)
src/Uno.UI/UI/Xaml/Automation/Peers/ComboBoxAutomationPeer.cs Implement WinUI-style children enumeration
src/Uno.UI/UI/Xaml/Automation/Peers/ButtonBaseAutomationPeer.cs Surface open flyout presenter as UIA child
src/Uno.UI/UI/Xaml/Automation/Peers/AutomationPeer.ProviderTargets.cs Resolve provider owners via parent chain for data peers
src/Uno.UI/UI/Xaml/Automation/Peers/AutomationPeer.cs Add default-pattern fallback in GetPattern
src/Uno.UI/UI/Xaml/Automation/Peers/AppBarLightDismissAutomationPeer.cs Add AppBar light-dismiss peer (new)
src/Uno.UI/UI/Xaml/Automation/AutomationHelper.cs Safer plain-text extraction fallback
src/Uno.UI/Helpers/WinUI/StringUtil.cs Add FormatMsg helper (FormatMessage-style)
src/Uno.UI/Helpers/WinUI/ResourceAccessor.ResourceKeys.cs Add UIA light-dismiss resource key constant
src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Controls/TitleBarAutomationPeer.cs Adjust generated TitleBarAutomationPeer stub guards
src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Automation.Peers/PivotItemDataAutomationPeer.cs Adjust generated PivotItemDataAutomationPeer stub guards
src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Automation.Peers/PivotItemAutomationPeer.cs Adjust generated PivotItemAutomationPeer stub guards
src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Automation.Peers/PivotAutomationPeer.cs Adjust generated PivotAutomationPeer stub guards
src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Automation.Peers/MediaTransportControlsAutomationPeer.cs Adjust generated MediaTransportControls peer stub guards
src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Automation.Peers/MediaPlayerElementAutomationPeer.cs Adjust generated MediaPlayerElement peer stub guards
src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Automation.Peers/ListViewItemDataAutomationPeer.cs Adjust generated ListViewItemDataAutomationPeer stub guards
src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Automation.Peers/GridViewItemDataAutomationPeer.cs Adjust generated GridViewItemDataAutomationPeer stub guards
src/Uno.UI/DirectUI/TextRangeAdapter.cs Add minimal ITextRangeProvider implementation (new)
src/Uno.UI/DirectUI/TextAdapter.cs Add minimal TextPattern provider implementation
src/Uno.UI/DirectUI/ScrollItemAdapter.cs Implement IScrollItemProvider via BringIntoView
src/Uno.UI.Tests/Helpers/Given_StringUtil_FormatMsg.cs Add unit tests for FormatMsg
src/Uno.UI.Runtime.Skia.Win32/Accessibility/Win32UIAutomationInterop.cs Add missing UIA pattern IDs
src/Uno.UI.Runtime.Skia.Win32/Accessibility/Win32SyntheticPaneProvider.cs Add synthetic pane providers (new)
src/Uno.UI.Runtime.Skia.Win32/Accessibility/Win32RawElementProvider.cs Add synthetic panes + template-part hit-test promotion
src/Uno.UI.Runtime.Skia.Win32/Accessibility/Win32AccessibilityPatterns.cs Add COM interfaces/wrappers for many UIA patterns
src/Uno.UI.Runtime.Skia.Win32/Accessibility/Win32Accessibility.cs Manage synthetic panes + virtual peer providers
Comments suppressed due to low confidence (7)

src/Uno.UI.Runtime.Skia.Win32/Accessibility/Win32AccessibilityPatterns.cs:784

  • This instantiates Microsoft.UI.Xaml.Automation.Provider.IRawElementProviderSimple via an internal constructor from another assembly (Uno.UI). In Uno.UI.Runtime.Skia.Win32 this will be inaccessible and fail compilation. Use a public factory/constructor or expose internals to this assembly, and apply the fix consistently across all occurrences in this file.
		Microsoft.UI.Xaml.Automation.Provider.IRawElementProviderSimple? managedStartAfter = null;
		if (startAfter is Win32RawElementProvider w32 && w32.RepresentedPeer is { } peer)
		{
			managedStartAfter = new Microsoft.UI.Xaml.Automation.Provider.IRawElementProviderSimple(peer);
		}

src/Uno.UI.Runtime.Skia.Win32/Accessibility/Win32AccessibilityPatterns.cs:833

  • new Microsoft.UI.Xaml.Automation.Provider.IRawElementProviderSimple() uses an internal parameterless ctor (in Uno.UI) from the Uno.UI.Runtime.Skia.Win32 assembly, which is not allowed and will fail compilation. Replace with a public factory/ctor, or expose internals to this assembly.

	public IUiaTextRangeProvider? RangeFromChild(IRawElementProviderSimple childElement)
		=> Wrap(_inner.RangeFromChild(ToManagedProvider(childElement) ?? new Microsoft.UI.Xaml.Automation.Provider.IRawElementProviderSimple()), _accessibility);

	public IUiaTextRangeProvider? RangeFromPoint(UiaPoint point)
		=> Wrap(_inner.RangeFromPoint(new Windows.Foundation.Point(point.X, point.Y)), _accessibility);

src/Uno.UI.Runtime.Skia.Win32/Accessibility/Win32AccessibilityPatterns.cs:841

  • new Microsoft.UI.Xaml.Automation.Provider.IRawElementProviderSimple() uses an internal ctor from the Uno.UI assembly, which is not accessible from Uno.UI.Runtime.Skia.Win32 and will fail compilation. Replace with a public factory/ctor, or expose internals to this assembly.

	public IUiaTextRangeProvider? RangeFromAnnotation(IRawElementProviderSimple annotationElement)
		=> Wrap(_inner.RangeFromAnnotation(ToManagedProvider(annotationElement) ?? new Microsoft.UI.Xaml.Automation.Provider.IRawElementProviderSimple()), _accessibility);

	public IUiaTextRangeProvider? GetCaretRange(out bool isActive)
		=> Wrap(_inner.GetCaretRange(out isActive), _accessibility);

src/Uno.UI.Runtime.Skia.Win32/Accessibility/Win32AccessibilityPatterns.cs:862

  • new Microsoft.UI.Xaml.Automation.Provider.IRawElementProviderSimple(peer) calls an internal ctor defined in Uno.UI. This file is compiled into Uno.UI.Runtime.Skia.Win32, so the constructor is inaccessible and will not compile. Use a public factory/ctor, or add an InternalsVisibleTo for the Win32 runtime assembly.
	internal static Microsoft.UI.Xaml.Automation.Provider.IRawElementProviderSimple? ToManagedProvider(IRawElementProviderSimple? comProvider)
	{
		if (comProvider is Win32RawElementProvider w32 && w32.RepresentedPeer is { } peer)
		{
			return new Microsoft.UI.Xaml.Automation.Provider.IRawElementProviderSimple(peer);
		}

src/Uno.UI.Runtime.Skia.Win32/Accessibility/Win32AccessibilityPatterns.cs:885

  • new Microsoft.UI.Xaml.Automation.Provider.IRawElementProviderSimple() uses an internal ctor from Uno.UI, which is not accessible from Uno.UI.Runtime.Skia.Win32 and will fail compilation. Replace with a public factory/ctor, or expose internals to this assembly.

	public IUiaTextRangeProvider? RangeFromChild(IRawElementProviderSimple childElement)
		=> UiaTextProvider2Wrapper.Wrap(_inner.RangeFromChild(UiaTextProvider2Wrapper.ToManagedProvider(childElement) ?? new Microsoft.UI.Xaml.Automation.Provider.IRawElementProviderSimple()), _accessibility);

	public IUiaTextRangeProvider? RangeFromPoint(UiaPoint point)

src/Uno.UI.Runtime.Skia.Win32/Accessibility/Win32RawElementProvider.cs:524

  • DependencyObject.GetTemplatedParent() here relies on an internal Uno.UI extension method, which isn’t visible to Uno.UI.Runtime.Skia.Win32 and will fail compilation. Either switch to a public templated-parent API or expose the required internal helper to this assembly (and keep the explanatory comment aligned with the chosen approach).
		UIElement? final = null;
		var iter = 0;
		while (walker is not null && iter++ < 64)
		{
			if (walker.GetTemplatedParent() is UIElement tpElement)
			{

src/Uno.UI.Runtime.Skia.Win32/Accessibility/Win32RawElementProvider.cs:545

  • This final.GetTemplatedParent() call depends on Uno.UI’s internal templated-parent store accessors, which are not accessible from the Uno.UI.Runtime.Skia.Win32 assembly. As-is this will not compile unless the needed helper is made public or Uno.UI adds an InternalsVisibleTo for this assembly.
		iter = 0;
		while (iter++ < 64)
		{
			if (final.GetTemplatedParent() is not UIElement tpElement)
			{
				break;
			}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

Copy link
Copy Markdown
Contributor

WinAppSDK sync generator drift detected on 6ceef3e

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.

@unodevops

Copy link
Copy Markdown
Contributor

@morning4coffe-dev

Copy link
Copy Markdown
Member Author

/apply-sync-gen

@github-actions

Copy link
Copy Markdown
Contributor

Pushed chore: Sync generator run to this PR branch.

GitHub does not re-trigger workflows for commits pushed by the default bot, so the WinAppSDK Sync Generator Check will not automatically re-run. To turn it green, push any additional commit (for example git commit --allow-empty -m "ci: re-run") or ask a maintainer to re-run the check.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ morning4coffe-dev
❌ github-actions[bot]
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI review requested due to automatic review settings May 17, 2026 15:32
@github-actions github-actions Bot added the area/build Categorizes an issue or PR as relevant to build infrastructure label May 17, 2026

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.

Pull request overview

Copilot reviewed 78 out of 88 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (2)

src/Uno.UI.Runtime.Skia.Win32/Accessibility/Win32AccessibilityPatterns.cs:784

  • Same issue as above: constructing Microsoft.UI.Xaml.Automation.Provider.IRawElementProviderSimple here relies on internal constructors. Without an InternalsVisibleTo for Uno.UI.Runtime.Skia.Win32 (or another factory approach), this will not compile.
		// startAfter arrives as a COM provider — translate via its peer so the
		// managed ItemContainer can compare item peers.
		Microsoft.UI.Xaml.Automation.Provider.IRawElementProviderSimple? managedStartAfter = null;
		if (startAfter is Win32RawElementProvider w32 && w32.RepresentedPeer is { } peer)
		{
			managedStartAfter = new Microsoft.UI.Xaml.Automation.Provider.IRawElementProviderSimple(peer);
		}

src/Uno.UI.Runtime.Skia.Win32/Accessibility/Win32AccessibilityPatterns.cs:839

  • new Microsoft.UI.Xaml.Automation.Provider.IRawElementProviderSimple() uses an internal constructor, so this also won’t compile from Uno.UI.Runtime.Skia.Win32 unless Uno.UI exposes internals to this assembly. Either avoid constructing this type here (if a null/other sentinel is acceptable) or add the appropriate InternalsVisibleTo/factory in Uno.UI.
	public IUiaTextRangeProvider? RangeFromChild(IRawElementProviderSimple childElement)
		=> Wrap(_inner.RangeFromChild(ToManagedProvider(childElement) ?? new Microsoft.UI.Xaml.Automation.Provider.IRawElementProviderSimple()), _accessibility);

	public IUiaTextRangeProvider? RangeFromPoint(UiaPoint point)
		=> Wrap(_inner.RangeFromPoint(new Windows.Foundation.Point(point.X, point.Y)), _accessibility);

	public IUiaTextRangeProvider? DocumentRange => Wrap(_inner.DocumentRange, _accessibility);
	public SupportedTextSelection SupportedTextSelection => _inner.SupportedTextSelection;

	public IUiaTextRangeProvider? RangeFromAnnotation(IRawElementProviderSimple annotationElement)
		=> Wrap(_inner.RangeFromAnnotation(ToManagedProvider(annotationElement) ?? new Microsoft.UI.Xaml.Automation.Provider.IRawElementProviderSimple()), _accessibility);

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

Copilot AI review requested due to automatic review settings May 18, 2026 08:28

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.

Pull request overview

Copilot reviewed 78 out of 88 changed files in this pull request and generated 3 comments.

Comment thread src/Uno.UI/DirectUI/TextAdapter.cs Resolved
@morning4coffe-dev
morning4coffe-dev merged commit 2af5e5f into master May 18, 2026
66 checks passed
@morning4coffe-dev
morning4coffe-dev deleted the dev/doti/gi-si-automation branch May 18, 2026 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/automation Categorizes an issue or PR as relevant to project automation area/build Categorizes an issue or PR as relevant to build infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants