Hi, is it possible to disable Back handle in M3 Mo...
# compose
y
Hi, is it possible to disable Back handle in M3 ModalBottomSheet?
s
Disable it completely? Try adding
androidx.activity.compose.BackHandler {}
in there and see what it does. I think it’s fair to assume that doing this is probably a very bad idea and will make it very frustrating for the user not being able to press back, but I assume you’re not going to do it too much 😅
y
BackHandler will not help, due to ModalBottomSheet open in another Window
a
You probably can do something like
Copy code
BackHandler(enabled=sheetState.isExpanded){}

ModalBottomSheet(state=sheetState...)
syntax can be a little different, just idea
So place back handler before sheet
y
Yes, I have already tried this idea) This code will have more priority than BackHandled
Copy code
ModalBottomSheetWindow.kt
a
The most stupid solution - expand sheet again when it was closed :D
s
When you say it’s in another window, what window are we talking about? How do you open that bottom sheet and why can you not put the back handler inside the code for the modal bottom sheet content? I haven’t tried doing this myself, just imagine that it should work
a
Probably PopupWindow has differnt back press handle logic, i think this is the first thing he tried because it's so obvious
b
Any updates on this? Or same issues today?