Does it do the same if you do the focus requesting on a click instead of via LaunchedEffect ?
a
Alex Styl
04/16/2025, 9:27 AM
yes. i changed it to launched effect so it's simpler to reproduce
d
dorche
04/16/2025, 10:38 AM
Focus Requester is a weird one that you might wanna keep reproducer to onClick, the system doesn't like focus being requested particularly early
E.g. in
FocusRequester.kt
:
Copy code
private const val FocusRequesterNotInitialized = """
FocusRequester is not initialized. Here are some possible fixes:
1. Remember the FocusRequester: val focusRequester = remember { FocusRequester() }
2. Did you forget to add a Modifier.focusRequester() ?
3. Are you attempting to request focus during composition? Focus requests should be made in
response to some event. Eg Modifier.clickable { focusRequester.requestFocus() }
"""
a
Alex Styl
04/16/2025, 10:57 AM
that is unrelated to what is being discussed
d
dorche
04/16/2025, 11:01 AM
Sure, but makes the reproducer closer to what the docs would want.