Object

SemanticsProperties

General semantics properties, mainly used for accessibility and testing.

Source set: 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

ContentDescription

Source set: Common
val ContentDescription =
    AccessibilityKey<List<String>>(
        name = "ContentDescription",
        mergePolicy = { parentValue, childValue ->
            parentValue?.toMutableList()?.also { it.addAll(childValue) } ?: childValue
        },
    )

StateDescription

Source set: Common
val StateDescription = AccessibilityKey<String>("StateDescription")

ProgressBarRangeInfo

Source set: Common
val ProgressBarRangeInfo = AccessibilityKey<ProgressBarRangeInfo>("ProgressBarRangeInfo")

PaneTitle

Source set: Common
val PaneTitle =
    AccessibilityKey<String>(
        name = "PaneTitle",
        mergePolicy = { _, _ ->
            throw IllegalStateException(
                "merge function called on unmergeable property PaneTitle."
            )
        },
    )

SelectableGroup

Source set: Common
val SelectableGroup = AccessibilityKey<Unit>("SelectableGroup")

CollectionInfo

Source set: Common
val CollectionInfo = AccessibilityKey<CollectionInfo>("CollectionInfo")

CollectionItemInfo

Source set: Common
val CollectionItemInfo = AccessibilityKey<CollectionItemInfo>("CollectionItemInfo")

Heading

Source set: Common
val Heading = AccessibilityKey<Unit>("Heading")

TextEntryKey

Source set: Common
val TextEntryKey = AccessibilityKey<Unit>("TextEntryKey")

Disabled

Source set: Common
val Disabled = AccessibilityKey<Unit>("Disabled")

LiveRegion

Source set: Common
val LiveRegion = AccessibilityKey<LiveRegionMode>("LiveRegion")

Focused

Source set: Common
val Focused = AccessibilityKey<Boolean>("Focused")

IsContainer

Deprecated

Use isTraversalGroup instead.

Source set: Common
val IsContainer = AccessibilityKey<Boolean>("IsContainer")

IsTraversalGroup

Source set: Common
val IsTraversalGroup = SemanticsPropertyKey<Boolean>("IsTraversalGroup")

IsSensitiveData

Source set: Common
val IsSensitiveData = SemanticsPropertyKey<Boolean>("IsSensitiveData")

InvisibleToUser

Deprecated

Use hideFromAccessibility instead.

Source set: Common
val InvisibleToUser =
    SemanticsPropertyKey<Unit>(
        name = "InvisibleToUser",
        mergePolicy = { parentValue, _ -> parentValue },
    )

HideFromAccessibility

Source set: Common
val HideFromAccessibility =
    SemanticsPropertyKey<Unit>(
        name = "HideFromAccessibility",
        mergePolicy = { parentValue, _ -> parentValue },
    )

ContentType

Source set: Common
val ContentType =
    SemanticsPropertyKey<ContentType>(
        name = "ContentType",
        mergePolicy = { parentValue, _ ->
            parentValue
        },
    )

ContentDataType

Source set: Common
val ContentDataType =
    SemanticsPropertyKey<ContentDataType>(
        name = "ContentDataType",
        mergePolicy = { parentValue, _ ->
            parentValue
        },
    )

FillableData

Source set: Common
val FillableData =
    SemanticsPropertyKey<FillableData>(
        name = "FillableData",
        mergePolicy = { parentValue, _ ->
            parentValue
        },
    )

TraversalIndex

Source set: Common
val TraversalIndex =
    SemanticsPropertyKey<Float>(
        name = "TraversalIndex",
        mergePolicy = { parentValue, _ ->
            parentValue
        },
    )

HorizontalScrollAxisRange

Source set: Common
val HorizontalScrollAxisRange = AccessibilityKey<ScrollAxisRange>("HorizontalScrollAxisRange")

VerticalScrollAxisRange

Source set: Common
val VerticalScrollAxisRange = AccessibilityKey<ScrollAxisRange>("VerticalScrollAxisRange")

IsPopup

Source set: 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."
            )
        },
    )

IsDialog

Source set: 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."
            )
        },
    )

Role

Source set: 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.

TestTag

Source set: Common
val TestTag =
    SemanticsPropertyKey<String>(
        name = "TestTag",
        isImportantForAccessibility = false,
        mergePolicy = { parentValue, _ ->
            parentValue
        },
    )

LinkTestMarker

Source set: 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.

Text

Source set: Common
val Text =
    AccessibilityKey<List<AnnotatedString>>(
        name = "Text",
        mergePolicy = { parentValue, childValue ->
            parentValue?.toMutableList()?.also { it.addAll(childValue) } ?: childValue
        },
    )

TextSubstitution

Source set: Common
val TextSubstitution = SemanticsPropertyKey<AnnotatedString>(name = "TextSubstitution")

IsShowingTextSubstitution

Source set: Common
val IsShowingTextSubstitution = SemanticsPropertyKey<Boolean>("IsShowingTextSubstitution")

InputText

Source set: Common
val InputText = AccessibilityKey<AnnotatedString>(name = "InputText")

EditableText

Source set: Common
val EditableText = AccessibilityKey<AnnotatedString>(name = "EditableText")

TextSelectionRange

Source set: Common
val TextSelectionRange = AccessibilityKey<TextRange>("TextSelectionRange")

TextCompositionRange

Source set: Common
val TextCompositionRange = AccessibilityKey<TextRange?>("TextCompositionRange")

ImeAction

Source set: Common
val ImeAction = AccessibilityKey<ImeAction>("ImeAction")

Selected

Source set: Common
val Selected = AccessibilityKey<Boolean>("Selected")

ToggleableState

Source set: Common
val ToggleableState = AccessibilityKey<ToggleableState>("ToggleableState")

InputTextSuggestionState

Source set: Common
val InputTextSuggestionState =
    AccessibilityKey<InputTextSuggestionState>("InputTextSuggestionState")

Password

Source set: Common
val Password = AccessibilityKey<Unit>("Password")

Error

Source set: Common
val Error = AccessibilityKey<String>("Error")

IndexForKey

Source set: Common
val IndexForKey = SemanticsPropertyKey<(Any) -> Int>("IndexForKey")

IsEditable

Source set: Common
val IsEditable = SemanticsPropertyKey<Boolean>("IsEditable")

MaxTextLength

Source set: Common
val MaxTextLength = SemanticsPropertyKey<Int>("MaxTextLength")

Shape

Source set: Common
val Shape =
    SemanticsPropertyKey<Shape>(
        name = "Shape",
        isImportantForAccessibility = false,
        mergePolicy = { parentValue, _ ->
            parentValue
        },
    )

Last updated: