/*@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
ContentDescription
val ContentDescription =
AccessibilityKey<List<String>>(
name = "ContentDescription",
mergePolicy = { parentValue, childValue ->
parentValue?.toMutableList()?.also { it.addAll(childValue) } ?: childValue
},
)
StateDescription
val StateDescription = AccessibilityKey<String>("StateDescription")
ProgressBarRangeInfo
val ProgressBarRangeInfo = AccessibilityKey<ProgressBarRangeInfo>("ProgressBarRangeInfo")
PaneTitle
val PaneTitle =
AccessibilityKey<String>(
name = "PaneTitle",
mergePolicy = { _, _ ->
throw IllegalStateException(
"merge function called on unmergeable property PaneTitle."
)
},
)
SelectableGroup
val SelectableGroup = AccessibilityKey<Unit>("SelectableGroup")
CollectionInfo
val CollectionInfo = AccessibilityKey<CollectionInfo>("CollectionInfo")
CollectionItemInfo
val CollectionItemInfo = AccessibilityKey<CollectionItemInfo>("CollectionItemInfo")
Heading
val Heading = AccessibilityKey<Unit>("Heading")
TextEntryKey
val TextEntryKey = AccessibilityKey<Unit>("TextEntryKey")
Disabled
val Disabled = AccessibilityKey<Unit>("Disabled")
LiveRegion
val LiveRegion = AccessibilityKey<LiveRegionMode>("LiveRegion")
Focused
val Focused = AccessibilityKey<Boolean>("Focused")
IsContainer
Deprecated
Use isTraversalGroup instead.
val IsContainer = AccessibilityKey<Boolean>("IsContainer")
IsTraversalGroup
val IsTraversalGroup = SemanticsPropertyKey<Boolean>("IsTraversalGroup")
IsSensitiveData
val IsSensitiveData = SemanticsPropertyKey<Boolean>("IsSensitiveData")
InvisibleToUser
Deprecated
Use hideFromAccessibility instead.
val InvisibleToUser =
SemanticsPropertyKey<Unit>(
name = "InvisibleToUser",
mergePolicy = { parentValue, _ -> parentValue },
)
HideFromAccessibility
val HideFromAccessibility =
SemanticsPropertyKey<Unit>(
name = "HideFromAccessibility",
mergePolicy = { parentValue, _ -> parentValue },
)
ContentType
val ContentType =
SemanticsPropertyKey<ContentType>(
name = "ContentType",
mergePolicy = { parentValue, _ ->
parentValue
},
)
ContentDataType
val ContentDataType =
SemanticsPropertyKey<ContentDataType>(
name = "ContentDataType",
mergePolicy = { parentValue, _ ->
parentValue
},
)
FillableData
val FillableData =
SemanticsPropertyKey<FillableData>(
name = "FillableData",
mergePolicy = { parentValue, _ ->
parentValue
},
)
TraversalIndex
val TraversalIndex =
SemanticsPropertyKey<Float>(
name = "TraversalIndex",
mergePolicy = { parentValue, _ ->
parentValue
},
)
HorizontalScrollAxisRange
val HorizontalScrollAxisRange = AccessibilityKey<ScrollAxisRange>("HorizontalScrollAxisRange")
VerticalScrollAxisRange
val VerticalScrollAxisRange = AccessibilityKey<ScrollAxisRange>("VerticalScrollAxisRange")
IsPopup
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."
)
},
)
IsDialog
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."
)
},
)
Role
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.
TestTag
val TestTag =
SemanticsPropertyKey<String>(
name = "TestTag",
isImportantForAccessibility = false,
mergePolicy = { parentValue, _ ->
parentValue
},
)
LinkTestMarker
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.
Text
val Text =
AccessibilityKey<List<AnnotatedString>>(
name = "Text",
mergePolicy = { parentValue, childValue ->
parentValue?.toMutableList()?.also { it.addAll(childValue) } ?: childValue
},
)
TextSubstitution
val TextSubstitution = SemanticsPropertyKey<AnnotatedString>(name = "TextSubstitution")
IsShowingTextSubstitution
val IsShowingTextSubstitution = SemanticsPropertyKey<Boolean>("IsShowingTextSubstitution")
InputText
val InputText = AccessibilityKey<AnnotatedString>(name = "InputText")
EditableText
val EditableText = AccessibilityKey<AnnotatedString>(name = "EditableText")
TextSelectionRange
val TextSelectionRange = AccessibilityKey<TextRange>("TextSelectionRange")
TextCompositionRange
val TextCompositionRange = AccessibilityKey<TextRange?>("TextCompositionRange")
ImeAction
val ImeAction = AccessibilityKey<ImeAction>("ImeAction")
Selected
val Selected = AccessibilityKey<Boolean>("Selected")
ToggleableState
val ToggleableState = AccessibilityKey<ToggleableState>("ToggleableState")
InputTextSuggestionState
val InputTextSuggestionState =
AccessibilityKey<InputTextSuggestionState>("InputTextSuggestionState")
Password
val Password = AccessibilityKey<Unit>("Password")
Error
val Error = AccessibilityKey<String>("Error")
IndexForKey
val IndexForKey = SemanticsPropertyKey<(Any) -> Int>("IndexForKey")
IsEditable
val IsEditable = SemanticsPropertyKey<Boolean>("IsEditable")
MaxTextLength
val MaxTextLength = SemanticsPropertyKey<Int>("MaxTextLength")
Shape
val Shape =
SemanticsPropertyKey<Shape>(
name = "Shape",
isImportantForAccessibility = false,
mergePolicy = { parentValue, _ ->
parentValue
},
)