Hi! I’m trying to replicate merging semantics info...
# compose
w
Hi! I’m trying to replicate merging semantics information of a component’s children from the testing tutorial, but I’m running into different results than the tutorial. 🧵
The tutorial states that: Some nodes merge the semantics information of their children. For example, a button with two text elements merges their labels:
Copy code
MyButton {
    Text("Hello")
    Text("World")
}
Printing the merged semantics tree it should result in:
Copy code
Node #1 at (...)px
 |-Node #2 at (...)px
   Role = 'Button'
   Text = '[Hello, World]'
   Actions = [OnClick, GetTextLayoutResult]
   MergeDescendants = 'true'
MyButton
is undefined in the tutorial, so I tried to replicate it using a plain material button:
Copy code
Button(onClick = { /*TODO*/ }) {
    Text("Foo")
}
But when printing the resulting tree, I get the following:
Copy code
1) Node #161 at (l=80.0, t=796.0, r=176.0, b=836.0)px
    Role = 'Button'
    Actions = [OnClick]
    MergeDescendants = 'true'
What I’m missing is having the text tag merged into the parent button. How is that achieved?