Zoltan Demant
10/25/2023, 10:05 AMZoltan Demant
10/25/2023, 10:11 AMModifier.focusRequester(x)
and requestFocus()
is called when its rendered (in a LaunchedEffect
). As expected.. it gets the focus.
Now my parent composable overlays the child composable, but the keyboard still shows up. Ideally Id like to have something akin to how I block touch events.
private fun Modifier.disableInteractions(): Modifier {
return pointerInput(Unit) {
awaitPointerEventScope {
while (true) {
awaitPointerEvent(Initial).run {
changes.forEach(PointerInputChange::consume)
}
}
}
}
}
Ive tried overriding LocalFocusManager
with a noop one, and LocalSoftwareKeyboardController
with null; but the keyboard still shows up. I suspect Ill need to create a way to block the entire Modifier.focusRequester(x)
part as well. Is there an easier way to go about it?Zoltan Demant
10/25/2023, 2:09 PMval LocalFocusEnabled: CompositionLocal<Boolean>
that I check before requesting focus. Would I have loved a better way? Yes. Does it work? Yes. If anyone knows a better approach, please enlighten me 😃Zach Klippenstein (he/him) [MOD]
10/25/2023, 5:11 PMModifier.focusProperties { canFocus = false }
Zoltan Demant
10/25/2023, 5:20 PMZach Klippenstein (he/him) [MOD]
10/25/2023, 5:22 PMZach Klippenstein (he/him) [MOD]
10/25/2023, 5:23 PMZoltan Demant
10/25/2023, 5:24 PMZach Klippenstein (he/him) [MOD]
10/25/2023, 5:24 PMZach Klippenstein (he/him) [MOD]
10/25/2023, 5:24 PMZach Klippenstein (he/him) [MOD]
10/25/2023, 5:25 PMZach Klippenstein (he/him) [MOD]
10/25/2023, 5:25 PMZoltan Demant
10/25/2023, 5:26 PMZoltan Demant
10/26/2023, 4:57 AMBasicTextField2
as well - but same exact behavior there too!Zach Klippenstein (he/him) [MOD]
10/26/2023, 5:04 PM