Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
80ea6c3
Fix for 33612
SuthiYuvaraj Jul 14, 2026
412affa
Fix for windows
SuthiYuvaraj Jul 14, 2026
c3787db
reverted windows
SuthiYuvaraj Jul 14, 2026
386e5b6
Fix with bounds
SuthiYuvaraj Jul 15, 2026
41489f4
Fix with Custom Accessibility class
SuthiYuvaraj Jul 15, 2026
1f42a4c
removed changes in unshipped
SuthiYuvaraj Jul 15, 2026
6111a5b
Update SemanticExtensions.cs
SuthiYuvaraj Jul 20, 2026
0d59d67
Update Issue33612.cs
SuthiYuvaraj Jul 21, 2026
9a88799
Update Issue33612.cs
SuthiYuvaraj Jul 21, 2026
964c7ac
Update SemanticExtensions.cs
SuthiYuvaraj Jul 27, 2026
581457e
Update MauiView.cs
SuthiYuvaraj Jul 27, 2026
ff82b7d
Accessibility issue
SuthiYuvaraj Aug 3, 2026
e55fa5b
Update Issue33612.cs
SuthiYuvaraj Aug 5, 2026
f1a9303
Testcase updates
SuthiYuvaraj Aug 18, 2026
64f2e91
Fix-33612
SuthiYuvaraj Oct 13, 2026
7ab5c37
Update MauiView.cs
SuthiYuvaraj Nov 17, 2026
dd49a89
Preserve native accessibility defaults on Apple content views
github-actions[bot] Nov 30, 2026
43f6113
Refresh Apple content accessibility for eligible tap gestures
github-actions[bot] Nov 30, 2026
ede45dd
Refresh Apple accessibility when presented content changes
github-actions[bot] Nov 30, 2026
7205cb9
Honor explicit Apple content accessibility tree settings
github-actions[bot] Nov 30, 2026
e8cac71
Test Apple content accessibility roles and parent semantic text
github-actions[bot] Nov 30, 2026
2fc4d29
Merge net11 into fix-accessibility-approach
github-actions[bot] Nov 30, 2026
3ff29a4
Find accessible primary taps after secondary taps
github-actions[bot] Dec 1, 2026
c46c6b4
Keep long-press content hosts accessible
github-actions[bot] Dec 1, 2026
89bb104
Preserve explicit accessibility roles with custom mappers
github-actions[bot] Dec 1, 2026
fc30373
Route native accessibility activation to content taps
github-actions[bot] Dec 1, 2026
b05e355
Refresh content accessibility roles after nested changes
github-actions[bot] Dec 1, 2026
4197e1d
[iOS] Dispatch all eligible accessibility taps on content hosts
github-actions[bot] Dec 1, 2026
2f534ea
[iOS] Skip redundant ancestor accessibility rescans
github-actions[bot] Dec 1, 2026
163fe36
[iOS] Preserve app Semantics mapper during ancestor refresh
github-actions[bot] Dec 1, 2026
e871aa5
[iOS] Cover direct activation of explicitly excluded content
github-actions[bot] Dec 1, 2026
456e239
[iOS] Refresh ancestor roles after the effective Semantics mapper
github-actions[bot] Dec 1, 2026
f28b1a9
[iOS] Preserve the native accessibility tap position
github-actions[bot] Dec 1, 2026
19b67cc
[iOS] Remap the content role when subtree exclusion changes
github-actions[bot] Dec 1, 2026
3a8a619
[iOS] Coalesce ancestor role refreshes during visibility propagation
github-actions[bot] Dec 1, 2026
1434e4b
[iOS] Test that only opacity zero crossings refresh ancestor roles
github-actions[bot] Dec 1, 2026
e67041d
Avoid ancestor rescans for accessible leaf text changes
github-actions[bot] Dec 1, 2026
a932a59
Refresh accessibility roles after effective opacity mapping
github-actions[bot] Dec 1, 2026
6f34e05
Refresh compatibility accessibility roles after semantics mapping
github-actions[bot] Dec 1, 2026
143d10a
Recognize virtual UIKit accessibility descendants
github-actions[bot] Dec 1, 2026
6ccfa0c
Distinguish parent and local accessibility activation coordinates
github-actions[bot] Dec 1, 2026
8c41f7b
Keep accessible content-host description edits local
github-actions[bot] Dec 1, 2026
b01cb3d
Refresh compatibility accessibility after opacity mapping
github-actions[bot] Dec 1, 2026
979d6b6
Refresh accessibility after automation mapper appends
github-actions[bot] Dec 1, 2026
e30cdc8
Replay reentrant descendant accessibility invalidation
github-actions[bot] Dec 1, 2026
97d09cf
Honor explicit native accessibility elements
github-actions[bot] Dec 1, 2026
c405554
Test accessible Button exclusion after Semantics mapping
github-actions[bot] Dec 1, 2026
246d31c
Test settled collection layouts skip ancestor refresh
github-actions[bot] Dec 1, 2026
9792d57
[iOS] Batch BindableLayout accessibility role refreshes
github-actions[bot] Dec 1, 2026
51d09ac
[iOS] Skip redundant compatibility renderer accessibility rescans
github-actions[bot] Dec 1, 2026
4b520c7
[iOS] Refresh accessibility after exclusion mapping
github-actions[bot] Dec 1, 2026
8bbb17f
[iOS] Refresh accessibility after Content mapping
github-actions[bot] Dec 1, 2026
d033dde
[iOS] Refresh ancestor accessibility after Visibility mapping
github-actions[bot] Dec 1, 2026
a1c0bc0
[iOS] Cover connected tap button-mask role transitions
github-actions[bot] Dec 1, 2026
b6a88dc
[iOS] Refresh ancestor roles after compatibility Visibility mapping
github-actions[bot] Dec 1, 2026
f22287a
Avoid eager UIKit subview marshaling in accessibility scans
github-actions[bot] Dec 1, 2026
d673c6c
Refresh Border accessibility after effective Content mapping
github-actions[bot] Dec 1, 2026
b2c96a2
Refresh ancestor accessibility after effective layout commands
github-actions[bot] Dec 1, 2026
f059c55
Refresh compatibility accessibility after renderer callbacks
github-actions[bot] Dec 1, 2026
74b470b
Refresh compatibility content role after content replacement
github-actions[bot] Dec 1, 2026
e938f76
Cover batched BindableLayout accessibility range notifications
github-actions[bot] Dec 1, 2026
ea92b54
Cover compatibility renderer accessible-leaf exclusion
github-actions[bot] Dec 1, 2026
d7a9194
Refresh iOS accessibility after effective Content mappings
github-actions[bot] Dec 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/Controls/src/Core/BindableLayout/BindableLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,9 @@ void CreateChildren()
return;
}

#if IOS || MACCATALYST
using var contentRoleRefresh = BeginContentRoleRefresh(layout);
#endif
if (TryAddEmptyView(layout, out IEnumerator enumerator))
{
return;
Expand Down Expand Up @@ -526,6 +529,9 @@ void ItemsSourceCollectionChanged(object sender, NotifyCollectionChangedEventArg
return;
}

#if IOS || MACCATALYST
using var contentRoleRefresh = BeginContentRoleRefresh(layout);
#endif
if (e.Action == NotifyCollectionChangedAction.Replace)
{
var index = e.OldStartingIndex;
Expand Down Expand Up @@ -570,6 +576,13 @@ void ItemsSourceCollectionChanged(object sender, NotifyCollectionChangedEventArg
reset: CreateChildren);
}

#if IOS || MACCATALYST
static Microsoft.Maui.Platform.SemanticExtensions.ContentRoleRefreshBatch BeginContentRoleRefresh(IBindableLayout layout) =>
layout is IElement { Handler.PlatformView: UIKit.UIView }
? Microsoft.Maui.Platform.SemanticExtensions.BeginContentRoleRefresh()
: null;
#endif

void ReplaceChild(object item, IBindableLayout layout, IList layoutChildren, int index)
{
var template = SelectTemplate(item, layout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Android.Content;
using PlatformView = Android.Views.View;
#elif IOS
using ContentSemantics = Microsoft.Maui.Platform.SemanticExtensions;
using PlatformView = UIKit.UIView;
#endif

Expand Down Expand Up @@ -121,7 +122,17 @@ protected virtual void OnElementChanged(ElementChangedEventArgs<TElement> e)
protected virtual void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (Element is TElement element && e.PropertyName != null)
_mapper.UpdateProperty(this, element, e.PropertyName);
{
#if IOS || MACCATALYST
if (e.PropertyName == AutomationProperties.ExcludedWithChildrenProperty.PropertyName
|| e.PropertyName == nameof(IView.Visibility))
ContentSemantics.UpdateContentRoleMapping(_mapper, this, element, e.PropertyName);
else
#endif
{
_mapper.UpdateProperty(this, element, e.PropertyName);
}
}

ElementPropertyChanged?.Invoke(sender, e);
ElementPropertyChangedPartial(sender, e);
Expand Down Expand Up @@ -307,6 +318,9 @@ void IElementHandler.SetVirtualView(Maui.IElement view)
// We use _virtualView as a WeakReference, and clear _tempElement
_virtualView = _tempElement is null ? null : new(_tempElement);
_tempElement = null;

if (((IElementHandler)this).PlatformView is PlatformView platformView)
Microsoft.Maui.Platform.SemanticExtensions.RefreshAncestorContentRoles(platformView);

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.

[moderate] Backward Compatibility and Migration - Initial compatibility content mapping does not refresh its own final role. Append to FrameRenderer.Mapper's Content mapping to set the native child's AccessibilityElementsHidden=true, then attach a Frame with Button content and Description already set. ProcessAutoPackage attaches the initially accessible Button before UpdateProperties; inherited Semantics runs before Content and makes the FrameView a grouped non-element. The Content append then hides the Button, but this finalization refreshes only ancestors of the FrameView, leaving neither a reachable child nor the parent's semantic focus stop. Subsequent Content updates and modern handlers refresh the host itself. Refresh the renderer's own content role after the complete initial mapping pass; ReplacingCompatibilityContentRestoresParentFocus sets Description only after attachment and misses this ordering.

}
#else
void IElementHandler.SetVirtualView(Maui.IElement view) =>
Expand All @@ -317,7 +331,39 @@ void IElementHandler.UpdateValue(string property)
{
if (Element is IElement element)
{
#if IOS || MACCATALYST
bool isSemantics = property == nameof(IView.Semantics);
bool isOpacity = property == nameof(IView.Opacity);
bool isVisibility = property == nameof(IView.Visibility);
bool isAutomationRole = property == AutomationProperties.IsInAccessibleTreeProperty.PropertyName;
var previousView = isSemantics || isOpacity ? ((IElementHandler)this).PlatformView as PlatformView : null;
bool wasAccessibleLeaf = isSemantics && previousView is not null && ContentSemantics.IsAccessibleLeaf(this, previousView);
bool wasNonTransparent = isOpacity && previousView is not null && ContentSemantics.IsNonTransparent(this, previousView);
bool contentChanged = property == AutomationProperties.ExcludedWithChildrenProperty.PropertyName
|| (property == nameof(IContentView.Content) && element is IContentView);
bool affectsRole = contentChanged || isSemantics || isOpacity || isVisibility || isAutomationRole;
using var refresh = affectsRole ? ContentSemantics.BeginContentRoleRefresh() : null;
#endif
OnElementPropertyChanged(element, new PropertyChangedEventArgs(property));
#if IOS || MACCATALYST
if (!affectsRole || !ReferenceEquals(Element, element) || ((IElementHandler)this).PlatformView is not PlatformView platformView)
return;

// Derived renderers and event subscribers can change the native role after the mapper.
if (contentChanged)
{
ContentSemantics.RefreshContentSemantics(this);
ContentSemantics.RefreshAncestorContentRoles(platformView);
}
else if (isVisibility || isAutomationRole
|| (isSemantics && (!wasAccessibleLeaf || !ReferenceEquals(previousView, platformView)
|| !ContentSemantics.IsAccessibleLeaf(this, platformView)))
|| (isOpacity && (!ReferenceEquals(previousView, platformView)
|| wasNonTransparent != ContentSemantics.IsNonTransparent(this, platformView))))
{
ContentSemantics.RefreshAncestorContentRoles(platformView);
}
#endif
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

namespace Microsoft.Maui.Controls.Handlers.Compatibility
{
public abstract partial class VisualElementRenderer<TElement> : UIView, IPlatformViewHandler, IElementHandler, IPlatformMeasureInvalidationController
public abstract partial class VisualElementRenderer<TElement> : UIView, IPlatformViewHandler, IElementHandler, IPlatformMeasureInvalidationController,
Microsoft.Maui.Platform.IRefreshesContentRolesAfterMapping
where TElement : Element, IView
{
bool _invalidateParentWhenMovedToWindow;
Expand Down
15 changes: 15 additions & 0 deletions src/Controls/src/Core/Element/Element.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Maui.Handlers;
using UIKit;

namespace Microsoft.Maui.Controls
Expand All @@ -10,6 +11,10 @@ public partial class Element
{
public static void MapAutomationPropertiesIsInAccessibleTree(IElementHandler handler, Element element)
{
if (handler is IViewHandler viewHandler && ReferenceEquals(handler.VirtualView, element)
&& Microsoft.Maui.Platform.SemanticExtensions.MapContentAccessibilityRole(viewHandler, AutomationProperties.GetIsInAccessibleTree(element)))
return;

// If the user hasn't set IsInAccessibleTree then just don't do anything
if (!element.IsSet(AutomationProperties.IsInAccessibleTreeProperty))
return;
Expand All @@ -28,6 +33,8 @@ public static void MapAutomationPropertiesIsInAccessibleTree(IElementHandler han
var _defaultIsAccessibilityElement = Control.IsAccessibilityElement || Control is UIControl;

Control.IsAccessibilityElement = (bool)((bool?)element.GetValue(AutomationProperties.IsInAccessibleTreeProperty) ?? _defaultIsAccessibilityElement);
if (handler is not (ElementHandler or Microsoft.Maui.Platform.IRefreshesContentRolesAfterMapping))
Microsoft.Maui.Platform.SemanticExtensions.RefreshAncestorContentRoles(Control);
}

public static void MapAutomationPropertiesExcludedWithChildren(IElementHandler handler, Element view)
Expand All @@ -39,6 +46,14 @@ public static void MapAutomationPropertiesExcludedWithChildren(IElementHandler h

var _defaultAccessibilityElementsHidden = Control.AccessibilityElementsHidden || Control is UIControl;
Control.AccessibilityElementsHidden = (bool)((bool?)view.GetValue(AutomationProperties.ExcludedWithChildrenProperty) ?? _defaultAccessibilityElementsHidden);
if (ReferenceEquals(handler.VirtualView, view)
&& Microsoft.Maui.Platform.SemanticExtensions.IsMappingContentRole(handler, AutomationProperties.ExcludedWithChildrenProperty.PropertyName))
return;

if (handler is IViewHandler viewHandler && ReferenceEquals(handler.VirtualView, view))
Microsoft.Maui.Platform.SemanticExtensions.ContentChanged(viewHandler);
Comment thread
github-actions[bot] marked this conversation as resolved.
Resolved
else
Microsoft.Maui.Platform.SemanticExtensions.RefreshAncestorContentRoles(Control);
}

static void MapAutomationPropertiesIsInAccessibleTree(IElementHandler handler, IElement element)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public override UICollectionReusableView GetViewForSupplementaryElement(UICollec
break;
}

(collectionView as MauiCollectionView)?.InvalidateAccessibilityContent();
return view;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ public override UICollectionViewCell GetCell(UICollectionView collectionView, NS
break;
}

(collectionView as MauiCollectionView)?.InvalidateAccessibilityContent();
return cell;
}

Expand Down Expand Up @@ -1067,6 +1068,7 @@ private protected virtual NSIndexPath GetAdjustedIndexPathForItemSource(NSIndexP

internal virtual void CellDisplayingEndedFromDelegate(UICollectionViewCell cell, NSIndexPath indexPath)
{
(CollectionView as MauiCollectionView)?.InvalidateAccessibilityContent();
if (cell is TemplatedCell templatedCell &&
(templatedCell.PlatformHandler?.VirtualView as View)?.BindingContext is object bindingContext)
{
Expand Down
43 changes: 42 additions & 1 deletion src/Controls/src/Core/Handlers/Items/iOS/MauiCollectionView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ namespace Microsoft.Maui.Controls.Handlers.Items;

public class MauiCollectionView : UICollectionView, IUIViewLifeCycleEvents, IPlatformMeasureInvalidationController
{
bool _accessibilityContentChanged;
bool _layingOutSubviews;
bool _invalidateParentWhenMovedToWindow;
bool? _isSwipeEnabled;
bool? _isBounceEnabled;
Expand Down Expand Up @@ -236,9 +238,48 @@ public override void AddSubview(UIView view)
// during the very first layout pass, before SetSwipeEnabled(false) below runs. We reapply on
// every layout pass, for both enabled and disabled, since Bounces can otherwise revert to its
// default (true) after UIKit reconfigures the embedded scroller.
internal void InvalidateAccessibilityContent()
{
if (_accessibilityContentChanged)
return;

_accessibilityContentChanged = true;
if (!_layingOutSubviews)
SetNeedsLayout();
}

/// <inheritdoc/>
public override void SubviewAdded(UIView uiview)
{
base.SubviewAdded(uiview);
InvalidateAccessibilityContent();
}

/// <inheritdoc/>
public override void WillRemoveSubview(UIView uiview)
{
base.WillRemoveSubview(uiview);
InvalidateAccessibilityContent();
}

public override void LayoutSubviews()
{
base.LayoutSubviews();
_layingOutSubviews = true;
try
{
base.LayoutSubviews();
}
finally
{
_layingOutSubviews = false;
}

if (_accessibilityContentChanged)
{
// Wait for UIKit to attach and remove deferred cells and supplementary views.
_accessibilityContentChanged = false;
Microsoft.Maui.Platform.SemanticExtensions.RefreshAncestorContentRoles(this);
}

if (_isSwipeEnabled.HasValue)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public override UICollectionReusableView GetViewForSupplementaryElement(UICollec
break;
}

(collectionView as Items.MauiCollectionView)?.InvalidateAccessibilityContent();
return view;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ public override UICollectionViewCell GetCell(UICollectionView collectionView, NS
DefaultCell2.Label.Text = ItemsSource[indexpathAdjusted].ToString();
}

(collectionView as MauiCollectionView)?.InvalidateAccessibilityContent();
return cell;
}

Expand Down Expand Up @@ -861,6 +862,7 @@ private protected virtual NSIndexPath GetAdjustedIndexPathForItemSource(NSIndexP

internal virtual void CellDisplayingEndedFromDelegate(UICollectionViewCell cell, NSIndexPath indexPath)
{
(CollectionView as MauiCollectionView)?.InvalidateAccessibilityContent();
if (cell is TemplatedCell2 templatedCell2 &&
(templatedCell2.PlatformHandler?.VirtualView as View)?.BindingContext is { } bindingContext)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public override UICollectionReusableView GetViewForSupplementaryElement(UICollec
break;
}

(collectionView as Items.MauiCollectionView)?.InvalidateAccessibilityContent();
return view;
}

Expand Down
Loading
Loading