diff --git a/src/Android/Avalonia.Android/AvaloniaAccessHelper.cs b/src/Android/Avalonia.Android/AvaloniaAccessHelper.cs index ac92aafc29..ca06998dbc 100644 --- a/src/Android/Avalonia.Android/AvaloniaAccessHelper.cs +++ b/src/Android/Avalonia.Android/AvaloniaAccessHelper.cs @@ -135,10 +135,30 @@ namespace Avalonia.Android protected override bool OnPerformActionForVirtualView(int virtualViewId, int action, Bundle? arguments) { return (GetNodeInfoProvidersFromVirtualViewId(virtualViewId) ?? []) - .Select(x => x.PerformNodeAction(action, arguments)) + .Select(x => TryPerformNodeAction(x, action, arguments)) .Aggregate(false, (a, b) => a | b); } + private static bool TryPerformNodeAction(INodeInfoProvider nodeInfoProvider, int action, Bundle? arguments) + { + try + { + return nodeInfoProvider.PerformNodeAction(action, arguments); + } + catch (ElementNotEnabledException) + { + return false; + } + catch (InvalidOperationException) + { + return false; + } + catch (NotSupportedException) + { + return false; + } + } + protected override void OnPopulateNodeForVirtualView(int virtualViewId, AccessibilityNodeInfoCompat? nodeInfo) { if (nodeInfo is null || !_peers.TryGetValue(virtualViewId, out AutomationPeer? peer))