[AccessibilityNode] Optimize Screen Reader Interactions
Solution
Unity 2021.x - Unity 6.3.x
Published Thu, Mar 12
UI elements obscured by Mask or Canvas overlays remain detectable by screen readers because the AccessibilityNode hierarchy operates independently of the standard GameObject hierarchy. This results in unintended focus and confusing audio feedback for non-visible elements.
The accessibility hierarchy in Unity is not automatically synchronized with visual visibility or the Canvas sorting order. Consequently, a GameObject that is visually hidden may still be reachable by assistive technologies. To resolve this, the AccessibilityNode.isActive property must be manually toggled to reflect the current UI state.
- Instantiate an AccessibilityNode for your script and register it via
Accessibility.AddNodewithin theOnEnablelifecycle. - Set AccessibilityNode.isActive to
falsewhenever the element is visually obscured by yourMask, a popup, or is otherwise non-interactable. - Define the AccessibilityNode.role using the
AccessibilityRoleenum to provide the screen reader with the correct semantic context. - Update the AccessibilityNode.label and AccessibilityNode.hint properties to convey the purpose and interaction method of the element.
- Call
Accessibility.UpdateNodeto push property changes from the AccessibilityNode to the active screen reader.
Additional Tips
- Screen reader announcement sequences, such as state-first or label-first, are dictated by the native OS (TalkBack/VoiceOver) and are not configurable via the Unity API.
- For dynamic lists, use the AccessibilityNode.value property to store positional information like “Item 5 of 20”.
- When a child element gains focus, prepending the parent context to your AccessibilityNode.label ensures the user maintains spatial awareness.
- Ensure
Accessibility.RemoveNodeis called when the AccessibilityNode is no longer needed to maintain hierarchy integrity.
TL;DR
Use the AccessibilityNode.isActive property to manage visibility and the Accessibility.UpdateNode method to synchronize changes between AccessibilityNode objects and the native screen reader.
Related Posts Haven't quite found a solution to your problem? We think these posts might help you.
Content inspired by a Unity discussion post.