/*@VisibleForTesting*/
object SemanticsProperties
General semantics properties, mainly used for accessibility and testing.
Each of these is intended to be set by the respective SemanticsPropertyReceiver extension instead of used directly.
Properties
val ContentDescription =
AccessibilityKey<List<String>>(
name = "ContentDescription",
mergePolicy = { parentValue, childValue ->
parentValue?.toMutableList()?.also { it.addAll(childValue) } ?: childValue
},
)
val StateDescription = AccessibilityKey<String>("StateDescription")
val ProgressBarRangeInfo = AccessibilityKey<ProgressBarRangeInfo>("ProgressBarRangeInfo")
val PaneTitle =
AccessibilityKey<String>(
name = "PaneTitle",
mergePolicy = { _, _ ->
throw IllegalStateException(
"merge function called on unmergeable property PaneTitle."
)
},
)
val SelectableGroup = AccessibilityKey<Unit>("SelectableGroup")
val CollectionInfo = AccessibilityKey<CollectionInfo>("CollectionInfo")
val CollectionItemInfo = AccessibilityKey<CollectionItemInfo>("CollectionItemInfo")
val Heading = AccessibilityKey<Unit>("Heading")
val TextEntryKey = AccessibilityKey<Unit>("TextEntryKey")
val Disabled = AccessibilityKey<Unit>("Disabled")
val LiveRegion = AccessibilityKey<LiveRegionMode>("LiveRegion")
val Focused = AccessibilityKey<Boolean>("Focused")
Deprecated Use isTraversalGroup instead.
val IsContainer = AccessibilityKey<Boolean>("IsContainer")
val IsTraversalGroup = SemanticsPropertyKey<Boolean>("IsTraversalGroup")
val IsSensitiveData = SemanticsPropertyKey<Boolean>("IsSensitiveData")
Deprecated Use hideFromAccessibility instead.
val InvisibleToUser =
SemanticsPropertyKey<Unit>(
name = "InvisibleToUser",
mergePolicy = { parentValue, _ -> parentValue },
)
val HideFromAccessibility =
SemanticsPropertyKey<Unit>(
name = "HideFromAccessibility",
mergePolicy = { parentValue, _ -> parentValue },
)
val ContentType =
SemanticsPropertyKey<ContentType>(
name = "ContentType",
mergePolicy = { parentValue, _ ->
parentValue
},
)
val ContentDataType =
SemanticsPropertyKey<ContentDataType>(
name = "ContentDataType",
mergePolicy = { parentValue, _ ->
parentValue
},
)
val FillableData =
SemanticsPropertyKey<FillableData>(
name = "FillableData",
mergePolicy = { parentValue, _ ->
parentValue
},
)
val TraversalIndex =
SemanticsPropertyKey<Float>(
name = "TraversalIndex",
mergePolicy = { parentValue, _ ->
parentValue
},
)
val HorizontalScrollAxisRange = AccessibilityKey<ScrollAxisRange>("HorizontalScrollAxisRange")
val VerticalScrollAxisRange = AccessibilityKey<ScrollAxisRange>("VerticalScrollAxisRange")
val IsPopup =
AccessibilityKey<Unit>(
name = "IsPopup",
mergePolicy = { _, _ ->
throw IllegalStateException(
"merge function called on unmergeable property IsPopup. " +
"A popup should not be a child of a clickable/focusable node."
)
},
)
val IsDialog =
AccessibilityKey<Unit>(
name = "IsDialog",
mergePolicy = { _, _ ->
throw IllegalStateException(
"merge function called on unmergeable property IsDialog. " +
"A dialog should not be a child of a clickable/focusable node."
)
},
)
val Role = AccessibilityKey<Role>("Role") { parentValue, _ -> parentValue }
The type of user interface element. Accessibility services might use this to describe the element or do customizations. Most roles can be automatically resolved by the semantics properties of this element. But some elements with subtle differences need an exact role. If an exact role is not listed in Role, this property should not be set and the framework will automatically resolve it.
val TestTag =
SemanticsPropertyKey<String>(
name = "TestTag",
isImportantForAccessibility = false,
mergePolicy = { parentValue, _ ->
parentValue
},
)
val LinkTestMarker =
SemanticsPropertyKey<Unit>(
name = "LinkTestMarker",
isImportantForAccessibility = false,
mergePolicy = { parentValue, _ -> parentValue },
)
Marks a link within a text node (a link is represented by a androidx.compose.ui.text.LinkAnnotation) for identification during automated testing. This property is for internal use only and not intended for general use by developers.
val Text =
AccessibilityKey<List<AnnotatedString>>(
name = "Text",
mergePolicy = { parentValue, childValue ->
parentValue?.toMutableList()?.also { it.addAll(childValue) } ?: childValue
},
)
val TextSubstitution = SemanticsPropertyKey<AnnotatedString>(name = "TextSubstitution")
val IsShowingTextSubstitution = SemanticsPropertyKey<Boolean>("IsShowingTextSubstitution")
val InputText = AccessibilityKey<AnnotatedString>(name = "InputText")
val EditableText = AccessibilityKey<AnnotatedString>(name = "EditableText")
val TextSelectionRange = AccessibilityKey<TextRange>("TextSelectionRange")
val TextCompositionRange = AccessibilityKey<TextRange?>("TextCompositionRange")
val ImeAction = AccessibilityKey<ImeAction>("ImeAction")
val Selected = AccessibilityKey<Boolean>("Selected")
val ToggleableState = AccessibilityKey<ToggleableState>("ToggleableState")
val InputTextSuggestionState =
AccessibilityKey<InputTextSuggestionState>("InputTextSuggestionState")
val Password = AccessibilityKey<Unit>("Password")
val Error = AccessibilityKey<String>("Error")
val IndexForKey = SemanticsPropertyKey<(Any) -> Int>("IndexForKey")
val IsEditable = SemanticsPropertyKey<Boolean>("IsEditable")
val MaxTextLength = SemanticsPropertyKey<Int>("MaxTextLength")
val Shape =
SemanticsPropertyKey<Shape>(
name = "Shape",
isImportantForAccessibility = false,
mergePolicy = { parentValue, _ ->
parentValue
},
)