https://kotlinlang.org logo
#compose
Title
# compose
t

theapache64

12/11/2023, 5:29 PM
Topic:
clearAndSetSemantics
function this 👇 removed the
testTag
from the merged tree
Copy code
Box(
    modifier = Modifier
        .clearAndSetSemantics {
            contentDescription = "My Red Box"
        }
        .testTag("red_box")
        .size(100.dp)
        .background(Color.Green)
) {

}
but moving the
clearAndSet
call after
testTag
doesn’t
Copy code
Box(
    modifier = Modifier
        .testTag("red_box")
        .clearAndSetSemantics {
            contentDescription = "My Red Box"
        }
        .size(100.dp)
        .background(Color.Green)

) {

}
Why modifier order works reverse here? 🤔
z

Zach Klippenstein (he/him) [MOD]

12/11/2023, 5:31 PM
It’s not reverse. Modifiers always apply to stuff under/after them. The
clearAndSetSemantics
function clears the semantics of everything under/after it.
👍 1
t

theapache64

12/11/2023, 5:51 PM
ohk. thanks
@Zach Klippenstein (he/him) [MOD] isn’t that conflicting with this ? 🤔