Skip to content

Instantly share code, notes, and snippets.

@salihgueler
Last active November 1, 2022 21:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save salihgueler/997ada4684e64a509bd1df28ebea312b to your computer and use it in GitHub Desktop.
Save salihgueler/997ada4684e64a509bd1df28ebea312b to your computer and use it in GitHub Desktop.
SemanticsProperties
property explanation
enabled It represents the subtree or the widget that is used can be either enabled or disabled state.
checked It represents checked state of a widget similar to checkbox.
toggled It represents on/off state of a widget similar to switch.
selected It indicates that this subtree represents a widget that can be in selected/unselected state.
button It represents a button is in this subtree.
header It represents a header is in this subtree
textfield It represents a text field is in the subtree
focused It represents that current node holds the input focus. It's not the same with Accessibility Focus
inMutuallyExclusiveGroup It represents if the node is in a mutually exclusive group. E.g. Radiobutton in radio group.
hidden It represents if the current node is hidden or not. Even though platforms are completely free to ignore hidden elements (they might be covered by other elements), if we want to reach it we can navigate to it by linear navigation.
obscured It represents whether the value should be obscured or not. Most common usecase is password views.
scopesRoute It represents whether the node corresponds to the root of a subtree for which a route name should be announced. Mostly used with explicitChildNodes to react to the unfocusable nodes by iOS and Android OSs.
namesRoute It represents whether the node has a semantic label or not.
image It represents an image is in the node.
liveRegion It represents if the node should be considered as a live region. Live region. In Android, views such can occur during the applications regular app process and it might cause a confusion. Live region will warn user and start reading the Semantics from the live region.
label Provides a description the the widget. In iOS it's used as accessibilityLabel in Accessibility protocol. On Android it creates a new text with value, hint and label.
value Provides a description of the value of the widget.
increadeValue The value to have after the increase action is performed.
decreasedValue The value to have after the decrease action is performed.
hint Description of an action performed on a widget.
hintOverrides In mobile OSs, there are default hint behaviours. On Android, label is used as hint when there is no hint. On iOS, there are default hints that is used when there is no hint. This property is used to override them.
textDirection The reading direction of the label, value, hint, increasedValue, decreasedValue.
sortkey It is used to describe the order of the node should be traversed by the accessibility services on the platform.
onTap Handler for the 'SemanticsAction.onTap' operation. It can be trigged by double-tapping in VoiceOver or TalkBack.
onLongPress Handler for the 'SemanticsAction.onLongPress' operation. It can be triggered by double-tapping and not leaving the button after second tap in VoiceOver or TalkBack.
onScrollLeft Handler for the 'SemanticsAction.onScrollLeft' operation. On iOS 3 finger swiping to left will trigger it. On Android swiping right then left will trigger it. onScrollUp and onScrollLeft share the same gesture. onScrollLeft is triggered with horizontal scrollable controllers, onScrollTop is triggered with vertical scrollable controllers.
onScrollRight Handler for the 'SemanticsAction.onScrollRight' operation. On iOS 3 finger swiping to right will trigger it. On Android swiping left then right will trigger it. onScrollDown and onScrollRight share the same gesture. onScrollRight is triggered with horizontal scrollable controllers, onScrollDown is triggered with vertical scrollable controllers.
onScrollUp Handler for the 'SemanticsAction.onScrollUp' operation. On iOS 3 finger swiping to up will trigger it. On Android swiping right then left will trigger it. onScrollUp and onScrollLeft share the same gesture. onScrollLeft is triggered with horizontal scrollable controllers, onScrollTop is triggered with vertical scrollable controllers.
onScrollDown Handler for the 'SemanticsAction.scrollDown' operation. On iOS 3 finger swiping to down will trigger it. On Android swiping left then right will trigger it. onScrollDown and onScrollRight share the same gesture. onScrollRight is triggered with horizontal scrollable controllers, onScrollDown is triggered with vertical scrollable controllers.
onIncrease Handler for the 'SemanticsAction.increase' operation of a value within widget. When there is a value and onIncrease action, increasedValue should be defined as well. On iOS it's triggered by swiping up with one finger. On Android it's triggered by volume up button.
onDecrease Handler for the 'SemanticsAction.decrease' operation of a value within widget. When there is a value and onDecrease action, decreasedValue should be defined as well. On iOS it's triggered by swiping down with one finger. On Android it's triggered by volume down button.
onCopy Handler for 'SemanticsAction.cut' action. It copies the selection and puts it to clipboard.
onCut Handler for 'SemanticsAction.cut' action. It copies the selection and puts it to clipboard.
onPaste Handler for 'SemanticsAction.paste' action. It pastes the current content of the clipboard to target.
onMoveCursorForwardByCharacter Handler for 'SemanticsAction.onMoveCursorBackwardByCharacter' action. It's used to move the cursor in a text field one character forward.
onMoveCursorBackwardByCharacter Handler for 'SemanticsAction.onMoveCursorBackwardByCharacter' action. It's used to move the cursor in a text field one character backward.
onMoveCursorForwardByWord Handler for 'SemanticsAction.onMoveCursorForwardByWord' action. It's used to move the cursor in a text field one word forward.
onMoveCursorBackwardByWord Handler for 'SemanticsAction.onMoveCursorBackwardByWord' action. It's used to move the cursor in a text field one word backward.
setSelection Handler for 'SemanticsAction.setSelection' action. It's used to either move the cursor within text or change the currently selected text.
onDidGainAccessibilityFocus Handler for 'SemanticsAction.onDidGainAccessibilityFocus' action. It's triggered when Accessibility focus (green box in Android, black box in iOS) is gained. Disclaimer: Accessibility Focus and Input Focus are two different things. They can be held by two different elements.
onDidLoseAccessibilityFocus Handler for 'SemanticsAction.onDidLoseAccessibilityFocus' action. It's triggered when Accessibility focus (green box in Android, black box in iOS) is lost. Disclaimer: Accessibility Focus and Input Focus are two different things. They can be held by two different elements.
onDismiss Handler for 'SemanticsAction.dismiss' action. It's used to trigger the current node.
customSemanticsActions Returns a map of custom actions. It's called whenever a 'emanticsEvent.customEvent' is called and this will call the related handler according to used action.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment