Browse Source

Fix GetVisualRootCore.

Needs to check for `IRootProvider`. Fixes integration tests on Windows.
pull/12330/head
Steven Kirk 3 years ago
parent
commit
ae82bc1b8f
  1. 14
      src/Avalonia.Controls/Automation/Peers/AutomationPeer.cs

14
src/Avalonia.Controls/Automation/Peers/AutomationPeer.cs

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using Avalonia.Automation.Provider;
namespace Avalonia.Automation.Peers
{
@ -254,17 +255,16 @@ namespace Avalonia.Automation.Peers
protected virtual AutomationPeer? GetVisualRootCore()
{
var parent = GetParent();
var peer = this;
var parent = peer.GetParent();
while (parent != null)
while (peer.GetProvider<IRootProvider>() is null && parent is not null)
{
var nextParent = parent.GetParent();
if (nextParent == null)
return parent;
parent = nextParent;
peer = parent;
parent = peer.GetParent();
}
return null;
return peer;
}

Loading…
Cancel
Save