Report - FocusRequester is not working on web both...
# compose-web
j
Report - FocusRequester is not working on web both js(IR) and WASM the same as in JVM
Copy code
Column {
        val focusRequester = remember { FocusRequester() }

        var value by remember { mutableStateOf("") }

        TextField(modifier = Modifier.focusRequester(focusRequester), value = value, onValueChange = {
            value = it
        })

        LaunchedEffect(Unit) {
            focusRequester.requestFocus()
        }
    }
I want to make a specific TextField FOCUSED on load. This code will mark it as "FOCUSED" but its not really focused since you cannot type.. it looks the browser is keeping the focus not the page. If you just do TAB it will work but yeah.. maybe there is no way to take the browser focus but this is less then ideal for webpages.. when we open google.com we dont have to tab before search 😞
🧵 1
a
slack is for discussions. for bug reports make sure to file them at https://github.com/JetBrains/compose-multiplatform/issues
j
sure will do that just wanted to mention it here as well but maybe I should have done it first there 😆 https://github.com/JetBrains/compose-multiplatform/issues/4878
thank you color 1
a
I personally ask in the respective channel to see if anyone else is experiencing the same issue or maybe im doing something wrong. the discussion usually reveals if it is a bug or not and then i open an issue
j
sure if someone answer here I will close the issue. I think the problem is the browser is holding the focus so maybe when we draw both in wasm or in js(ir) the canvas we have to move the focus to it