Version: Unity 6.3 Beta (6000.3)
LanguageEnglish
  • C#

AccessibilityRole.Toggle

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

The accessibility node behaves like a toggle.


Platform-specific behavior

- Android: If this role is set on a node, the screen reader announces the node as a "switch". After a short pause, it provides instructions on how to toggle it. If the node has AccessibilityState.Selected set, the screen reader reads "on" before announcing the node's label. Otherwise, it reads "off". - iOS: If this role is set on a node, the screen reader announces the node as a "switch button". After a short pause, it provides instructions on how to toggle it. If the node has AccessibilityState.Selected set, the screen reader reads "selected" before announcing the node's label. Otherwise, it does not read the node's state. - macOS: If this role is set on a node, the screen reader announces the node as a "checkbox". After a short pause, it provides instructions on how to toggle it. If the node has AccessibilityState.Selected set, the screen reader reads "checked" after announcing the node's label. Otherwise, it reads "unchecked". - Windows: If this role is set on a node, the screen reader announces the node as a "checkbox". If the node has AccessibilityState.Selected set, the screen reader reads "checked" after announcing the node's label. Otherwise, it reads "unchecked".

Subscribe to the AccessibilityNode.invoked event to inform the screen reader that the node can be activated, and perform an appropriate action when the user activates it, such as changing the value of the toggle represented by the node.

Platform support: On iOS, this role is only supported starting with iOS 17.