```SelectionContainer { DropdownMenu(...) { ...
# compose-desktop
p
Copy code
SelectionContainer {
  DropdownMenu(...) {
    Text("Some text") // when click on text got java.lang.IllegalArgumentException: layouts are not part of the same hierarchy
  }
}
Is it known issue or should i create new one?
a
Put the selection container around the text
p
This is example for demo. In real project selection container is in many functions up in the call stack. As a workaround i wrap DropdownMenu with DisableSelection, but the bug with Compose remains.
a
A
SelectionContainer
allows the user to select text across several textual elements. The content of a dropdown is displayed in a separate layout hierarchy; possibly in a separate window. You can’t select text across different layout hierarchies.
p
Yes. I needn't do it. I think in such case DropdownMenu's text content should be silently ignored instead of throwing exception.
a
Silently ignoring is not always a good idea. You want to let the developer know he’s trying something that’s not going to work.
p
Make sense.