Since you haven't shared any code here, this is how I would have handle this issue:
Use the Disposable Effect and onDispose handle the keyboard hiding
Sample Code:
...
val keyboardController = LocalSoftwareKeyboardController.current
DisposableEffect(key1 = modalBottomSheetState.isVisible, effect = {
onDispose {
keyboardController?.hide()
}
})
...
The LocalSoftwareKeyboardController is marked as Experimental so you can also do the following:
...
val focusManager = LocalFocusManager.current
DisposableEffect(key1 = modalBottomSheetState.isVisible, effect = {
onDispose {
focusManager.clearFocus()
}
})
...