Skip to content

Commit

Permalink
Fix usage of semantics within ContentVisibility
Browse files Browse the repository at this point in the history
Changed to the semantics modifier from clearAndSemantics.
Content in ContentVisibility is now correctly recognized by UiAutomator.
  • Loading branch information
ogaclejapan committed Jun 9, 2024
1 parent 22de572 commit bafa3b1
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.semantics.clearAndSetSemantics
import androidx.compose.ui.semantics.invisibleToUser
import androidx.compose.ui.semantics.semantics

/**
* A composable that can hide its [content] without removing it from the layout.
Expand All @@ -32,7 +32,7 @@ fun ContentVisibility(
Box(
modifier = modifier
.alpha(if (hidden) 0f else 1f)
.clearAndSetSemantics {
.semantics {
if (hidden) {
invisibleToUser()
}
Expand Down

0 comments on commit bafa3b1

Please sign in to comment.