Status Update
Comments
ha...@gmail.com <ha...@gmail.com> #2
we are in the process of fixing clickable + ripple, appologies for the bug atm
jo...@google.com <jo...@google.com> #3
Are there plans for a more general solution to prevent this? In any case, I will reassign this to me to fix it for dev14.
jo...@google.com <jo...@google.com> #4
modifier
.clickable(enabled = enabled, onClick = onClick)
.ripple(enabled = enabled)
ripple should be used before clickable (when clickable was a modifier), so it can show indication, while also allowing to click. With clickable.ripple ripple will click and eat all the clicks.
To make this error-safe, ripple will be deprecated and clickable how have build-in ripple indication, so noone will be able to face incorrect order. If you want to allow users to customize ripple indication, you can accept Indication param and pass it to the clickable.
Let me know if you need any help fixing this
jo...@google.com <jo...@google.com> #5
Branch: androidx-master-dev
commit 6df744e9fe739e832be172df0733229908819377
Author: Mihai Popa <popam@google.com>
Date: Fri May 29 16:45:07 2020
Fix onClick not invoked on DropdownMenuItems
Relnote: "Fixed onClick not being invoked for DropdonMenuItems."
Bug: 157673259
Test: MenuTest
Change-Id: I3998b374f4ad047c5a24521b5d3ba928be2e3e69
M ui/ui-material/src/androidTest/java/androidx/ui/material/MenuTest.kt
M ui/ui-material/src/main/java/androidx/ui/material/Menu.kt
jo...@google.com <jo...@google.com> #6
I'll add that the bottom sheet "floats" above the bottom of the screen
Would you mind filing a separate issue for this? I wasn't able to reproduce it yet.
ha...@gmail.com <ha...@gmail.com> #7
Thanks for the quick reply!
Would you mind filing a separate issue for this?
Sure, I'll see if I can figure out in which specific conditions it happens and open a new issue
jo...@google.com <jo...@google.com> #8
Thanks! I found a repro (and the cause) for this so just an issue without a repro is totally fine :)
ha...@gmail.com <ha...@gmail.com> #9
Here's the new issue
For some completeness I added a video and a link to the same repo as in this issue
ap...@google.com <ap...@google.com> #10
Branch: androidx-main
commit 43ba01d4fc84edb9495a2089090bcd2f786be743
Author: Jossi Wolf <jossiwolf@google.com>
Date: Mon Jan 16 12:11:00 2023
Handle absence of previous target in ModalBottomSheetAnchorChangeHandler
When we animate or snap, we update the currentValue regardless of whether it exists in the anchors. If ModalBottomSheetState was moved to a visible value (HalfExpanded or Expanded) while only having a hidden anchor (when the sheet content is empty), we would crash in the AnchorChangeHandler because we required the previous target to be present in the previous set of anchors.
Test: modalBottomSheet_shortSheet_anchorChangeHandler_previousTargetNotInAnchors_reconciles, modalBottomSheet_tallSheet_anchorChangeHandler_previousTargetNotInAnchors_reconciles
Relnote: Fixed a bug in ModalBottomSheetLayout where the sheet would crash when going from the hidden to a visible state in some circumstances.
Bug: 265444789
Change-Id: Ia926514a65dc4d2c44781e132f8faae7e442cf68
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ModalBottomSheetTest.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/ModalBottomSheet.kt
jo...@google.com <jo...@google.com>
ha...@gmail.com <ha...@gmail.com> #11
Does this also fix the crash I described in
jo...@google.com <jo...@google.com> #12
Yep, it also fixes that :)
ha...@gmail.com <ha...@gmail.com> #13
Awesome :)
pr...@google.com <pr...@google.com> #14
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.material:material:1.4.0-alpha05
Description
Jetpack Compose version: 1.4.0-alpha04
Jetpack Compose component used: ModalBottomSheetLayout
Android Studio Build: Electric Eel 2022.1.1 #AI-221.6008.13.2211.9477386
Kotlin version: 1.7.21
Repo:https://github.com/hakonschia/bottomsheetcrash
The updated ModalBottomSheetLayout in 1.4.0-alpha04 seems to have some issues. I have observed two cases where it crashes with
Key HalfExpanded is missing in the map
. The linked repo contains both scenarios.First scenario:
I'll add that the bottom sheet "floats" above the bottom of the screen, which seems like a new bug introduced in alpha04. In the example repo this only happens when the sheet is opened in landscape. If I open it in portrait and then rotate, it doesn't happen. It also doesn't crash in this case, so it seems this might be related. This is visible in the video attached.
Second scenario:
The updated ModalBottomSheetLayout is supposed to support empty sheet content, but when going from empty content to some content it crashes.
Steps to reproduce:
I'll add here that I have had to do this hack with empty content to avoid the bottom sheet sometimes being visible when it shouldn't, for example when resizing the window in Picture-in-Picture mode (which might be related to https://issuetracker.google.com/issues/260517771 ). I've added a button to enter PiP where this issue can be seen by removing the logic to not render the content when not visible.
Adding
Spacer(Modifier.height(1.dp))
fixes this crash, which is what I had to do previously anyways since empty content wasn't supported, but I'd like to remove this hack.Stack trace (if applicable):