compose-multiplatform
                                
                                 compose-multiplatform copied to clipboard
                                
                                    compose-multiplatform copied to clipboard
                            
                            
                            
                        Rendering a composable above the window causes a crash after changing the window size.
Describe the bug After changing the browser window size, if some composable that renders above the window, it causes the application to crash.
Affected platforms
- Web (K/Wasm) - Canvas based API
Versions
- Kotlin version*: 1.9.21
- Compose Multiplatform version*: 1.6.0-beta02
To Reproduce
- Go to kmp.jetbrains.com
- Selected Wasm option
- Download the project
- Replace the App() function for the codesnippet below
- Run the app in your browser
- Resize the browser screen size and click in the field to open the menu
Code Snippet:
import androidx.compose.foundation.layout.*
import androidx.compose.material.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowDropDown
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
@OptIn(ExperimentalMaterialApi::class)
@Composable
fun App() {
    MaterialTheme {
        var expanded by remember { mutableStateOf(false) }
        val items = listOf("1", "2")
        var selectedOptionText by remember { mutableStateOf(items[0]) }
        ExposedDropdownMenuBox(
            expanded = expanded,
            onExpandedChange = {
                expanded = it
            },
        ) {
            OutlinedTextField(
                modifier = Modifier
                    .fillMaxWidth()
                    .padding(top = 16.dp),
                value = selectedOptionText,
                onValueChange = {},
                readOnly = true
            )
            ExposedDropdownMenu(
                expanded = expanded,
                onDismissRequest = {
                    expanded = false
                },
            ) {
                items.forEach { selectionOption ->
                    DropdownMenuItem(
                        onClick = {
                            selectedOptionText = selectionOption
                            expanded = false
                        },
                    ) {
                        Text(selectionOption)
                    }
                }
            }
        }
    }
}
Error: Cannot coerce value to an empty range: maximum -1470 is less than minimum 0.
Expected behavior Don't crash the app and show the menu according
Screenshots https://github.com/JetBrains/compose-multiplatform/assets/85970251/9fa07a00-6d40-4008-8e50-e1bde2824c0d
Additional context Tested with material and material3 themes Tested with ExposedDropdownMenuBox and ModalBottomSheet
Hi, has this issue been fixed yet? As I just saw https://github.com/JetBrains/compose-multiplatform/issues/4260. But after upgrading to 1.6.0-rc01 it is still crashing when resizing the window after opening a ModalBottomSheet.
Hi, has this issue been fixed yet? As I just saw #4260. But after upgrading to 1.6.0-rc01 it is still crashing when resizing the window after opening a ModalBottomSheet.
The fix didn't get into 1.6.0
I have the same error on desktop. Windows 11 Pro 23H2 22631.3155 JDK 17.0.2 compose plugin 1.6.0. Should I open new issue?
@vladyslavv-ua This issue is web-specific, it cannot be the same on Desktop. Yes, open a new one please.
Couldn't reproduce it anymore on 1.6.10-beta01 and afterwards.
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.