I was testing my app to see if an open `DropdownMe...
# compose-android
r
I was testing my app to see if an open
DropdownMenu
stays open after a trip through the background. It does, but I can only get it into the background with the open menu intact by using the home button of 2 or 3-button navigation, not by using swipe up to home with gesture navigation. For the latter, the menu appears to close before going into the background, due to the gesture itself. I’m wondering if this can be fixed. (Video, more details, and code in thread.)
Dropdown.gesture.mp4,Dropdown.3-button.mp4
Further details when using gesture navigation: • When swiping for a back swipe or swiping at the bottom to move to the next app the menu also closes (the back swipe is WAI according to documentation). • After swiping down from the top and swiping back up, the menu stays open. • When the app is in split screen, the menu stays open when resizing the window, even when resizing it back to full screen.
Copy code
@Composable
fun MenuBackgroundTest() {
    Column(modifier = Modifier.padding(20.dp)) {
        var openMenu by rememberSaveable { mutableStateOf(false) }
        IconButton(
            onClick = {
                openMenu = true
            }
        ) {
            Icon(<http://Icons.Default.Menu|Icons.Default.Menu>, contentDescription = "")
        }
        DropdownMenu(
            expanded = openMenu,
            onDismissRequest = {
                openMenu = false
            }
        ) {
            for (i in 1..4) {
                DropdownMenuItem(
                    text = {
                        Text("Item $i")
                    },
                    onClick = {
                        openMenu = false
                    }
                )
            }
        }
    }
}
This doesn’t change if I add
Copy code
properties = PopupProperties(
    dismissOnClickOutside = false
)
to
DropdownMenu
.