Object

SemanticsProperties

General semantics properties, mainly used for accessibility and testing.

RevenueCat

RevenueCat

Add subscriptions to your apps in minutes

Ad Get started for free
Common
/*@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

Common
val ContentDescription =
    AccessibilityKey<List<String>>(
        name = "ContentDescription",
        mergePolicy = { parentValue, childValue ->
            parentValue?.toMutableList()?.also { it.addAll(childValue) } ?: childValue
        },
    )
Common
val StateDescription = AccessibilityKey<String>("StateDescription")
Common
val ProgressBarRangeInfo = AccessibilityKey<ProgressBarRangeInfo>("ProgressBarRangeInfo")
Common
val PaneTitle =
    AccessibilityKey<String>(
        name = "PaneTitle",
        mergePolicy = { _, _ ->
            throw IllegalStateException(
                "merge function called on unmergeable property PaneTitle."
            )
        },
    )
Common
val SelectableGroup = AccessibilityKey<Unit>("SelectableGroup")
Common
val CollectionInfo = AccessibilityKey<CollectionInfo>("CollectionInfo")
Common
val CollectionItemInfo = AccessibilityKey<CollectionItemInfo>("CollectionItemInfo")
Common
val Heading = AccessibilityKey<Unit>("Heading")
Common
val TextEntryKey = AccessibilityKey<Unit>("TextEntryKey")
Common
val Disabled = AccessibilityKey<Unit>("Disabled")
Common
val LiveRegion = AccessibilityKey<LiveRegionMode>("LiveRegion")
Common
val Focused = AccessibilityKey<Boolean>("Focused")
Common
Deprecated Use isTraversalGroup instead.
val IsContainer = AccessibilityKey<Boolean>("IsContainer")
Common
val IsTraversalGroup = SemanticsPropertyKey<Boolean>("IsTraversalGroup")
Common
val IsSensitiveData = SemanticsPropertyKey<Boolean>("IsSensitiveData")
Common
Deprecated Use hideFromAccessibility instead.
val InvisibleToUser =
    SemanticsPropertyKey<Unit>(
        name = "InvisibleToUser",
        mergePolicy = { parentValue, _ -> parentValue },
    )
Common
val HideFromAccessibility =
    SemanticsPropertyKey<Unit>(
        name = "HideFromAccessibility",
        mergePolicy = { parentValue, _ -> parentValue },
    )
Common
val ContentType =
    SemanticsPropertyKey<ContentType>(
        name = "ContentType",
        mergePolicy = { parentValue, _ ->
            parentValue
        },
    )
Common
val ContentDataType =
    SemanticsPropertyKey<ContentDataType>(
        name = "ContentDataType",
        mergePolicy = { parentValue, _ ->
            parentValue
        },
    )
Common
val FillableData =
    SemanticsPropertyKey<FillableData>(
        name = "FillableData",
        mergePolicy = { parentValue, _ ->
            parentValue
        },
    )
Common
val TraversalIndex =
    SemanticsPropertyKey<Float>(
        name = "TraversalIndex",
        mergePolicy = { parentValue, _ ->
            parentValue
        },
    )
Common
val HorizontalScrollAxisRange = AccessibilityKey<ScrollAxisRange>("HorizontalScrollAxisRange")
Common
val VerticalScrollAxisRange = AccessibilityKey<ScrollAxisRange>("VerticalScrollAxisRange")
Common
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."
            )
        },
    )
Common
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."
            )
        },
    )
Common
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.

Common
val TestTag =
    SemanticsPropertyKey<String>(
        name = "TestTag",
        isImportantForAccessibility = false,
        mergePolicy = { parentValue, _ ->
            parentValue
        },
    )
Common
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.

Common
val Text =
    AccessibilityKey<List<AnnotatedString>>(
        name = "Text",
        mergePolicy = { parentValue, childValue ->
            parentValue?.toMutableList()?.also { it.addAll(childValue) } ?: childValue
        },
    )
Common
val TextSubstitution = SemanticsPropertyKey<AnnotatedString>(name = "TextSubstitution")
Common
val IsShowingTextSubstitution = SemanticsPropertyKey<Boolean>("IsShowingTextSubstitution")
Common
val InputText = AccessibilityKey<AnnotatedString>(name = "InputText")
Common
val EditableText = AccessibilityKey<AnnotatedString>(name = "EditableText")
Common
val TextSelectionRange = AccessibilityKey<TextRange>("TextSelectionRange")
Common
val TextCompositionRange = AccessibilityKey<TextRange?>("TextCompositionRange")
Common
val ImeAction = AccessibilityKey<ImeAction>("ImeAction")
Common
val Selected = AccessibilityKey<Boolean>("Selected")
Common
val ToggleableState = AccessibilityKey<ToggleableState>("ToggleableState")
Common
val InputTextSuggestionState =
    AccessibilityKey<InputTextSuggestionState>("InputTextSuggestionState")
Common
val Password = AccessibilityKey<Unit>("Password")
Common
val Error = AccessibilityKey<String>("Error")
Common
val IndexForKey = SemanticsPropertyKey<(Any) -> Int>("IndexForKey")
Common
val IsEditable = SemanticsPropertyKey<Boolean>("IsEditable")
Common
val MaxTextLength = SemanticsPropertyKey<Int>("MaxTextLength")
Common
val Shape =
    SemanticsPropertyKey<Shape>(
        name = "Shape",
        isImportantForAccessibility = false,
        mergePolicy = { parentValue, _ ->
            parentValue
        },
    )