Has anyone else noticed the `ExposedDropdownMenuBo...
# compose
m
Has anyone else noticed the
ExposedDropdownMenuBox
component not accepting hardware keyboard input? When i run in the emulator, it is unable to accept any hardware keyboard input when the dropdown is active. The soft keyboard works just fine though. Code in đź§µ
Copy code
val allItems = listOf(
        "Tyrion Lannister",
        "Daenerys Targaryen",
        "Jon Snow",
        "Sansa Stark",
    )

    Column(
        modifier = Modifier
            .fillMaxSize()
            .padding(16.dp)
    ) {
        var query by remember { mutableStateOf("") }
        var active by remember { mutableStateOf(false) }

        ExposedDropdownMenuBox(
            expanded = active,
            onExpandedChange = { active = it }
        ) {
            OutlinedTextField(
                modifier = Modifier
                    .menuAnchor()
                    .onFocusChanged {
                        if (it.isFocused) {
                            active = true
                        }
                    },
                value = query,
                onValueChange = {
                    query = it
                    active = true
                }
            )

            val filtered = allItems.filter {
                it.contains(query, ignoreCase = true)
            }
            if (filtered.isNotEmpty()) {
                    ExposedDropdownMenu(
                        expanded = active,
                        onDismissRequest = { active = false }
                    ) {
                        filtered.forEach {
                            DropdownMenuItem(
                                onClick = {
                                    query = it
                                    active = false
                                },
                                text = {
                                    Text(it)
                                }
                            )
                        }
                    }
            }
        }
    }
y
you would have to set this onDismissRequest = { active = false } as this onDismissRequest = { }, make it empty. other than that I also noticed that when ever the keyboard is shown it gets laggy for some reason
m
My solution was to just use DropDownMenu instead, so that i can set it’s focusable popup property to false. That’s the real issue here from what i gather. ExposedDropDownMenu doesn’t expose the PopupProperties, and the default for that value is true.