Add semantics key/value pairs to the layout node, for use in testing, accessibility, etc.
SubspaceSemanticsModifierSample
public fun SubspaceSemanticsModifierSample() {
@Composable
fun AppContent() {
// Mental Model: The "Picture Frame" (3D Container) vs. the "Canvas" (2D Content)
Subspace {
SpatialPanel(
modifier =
SubspaceModifier.semantics {
// Set spatial semantics on the 3D container (the "Picture Frame")
testTag = "main_settings_panel"
contentDescription = "System Settings Window"
}
) {
// Standard 2D Compose UI goes inside (the "Canvas").
// These elements use standard Modifier.semantics for TalkBack and interactions.
Column {
Text("System Settings")
Button(
onClick = { /* do something */ },
modifier = Modifier.semantics { contentDescription = "Perform action" },
) {
Text("Click Me")
}
}
}
}
}
}