Status Update
Comments
zx...@gmail.com <zx...@gmail.com> #2
We could add an API to make the weighted distance customizable, aosp/3271691 has more info.
to...@gmail.com <to...@gmail.com> #3
Also facing this, if restarting a scroll during an active scroll then the bottom sheet will intercept and dismiss instead of allowing the nested component to scroll.
to...@gmail.com <to...@gmail.com> #4
As a temporary workaround in consumeSwipeWithinBottomSheetBoundsNestedScrollConnection
have onPreFling
and onPostFling
always return Velocity.Zero
to not mess with the scrolling components.
Not 100% perfect but still a millions times better than unwanted closing and broken interactions.
ma...@gmail.com <ma...@gmail.com> #5
As mentioned in
As a temporary fix, we can revert BottomSheetAnimationSpec to what it was before:
/**
* Latest Material3 Compose library (1.3.0) has a bug in BottomSheetScaffold where scrolling
* content sometimes bottom sheet takes scroll event and collapses.
* Open issue to track this: https://issuetracker.google.com/issues/353304855
* This hack should be removed once the open issue on Google Tracker is fixed.
*/
private fun modifyBottomSheetAnimationSpec() {
runCatching {
Class
.forName("androidx.compose.material3.SheetDefaultsKt")
.getDeclaredField("BottomSheetAnimationSpec").apply {
isAccessible = true
}.set(null, SpringSpec<Float>())
}
}
This fixes the issue of bottomsheet taking scroll events instead of actual content.
co...@gmail.com <co...@gmail.com> #6
This other issue seems to confirm that the issue exists in 1.2
se...@google.com <se...@google.com>
se...@google.com <se...@google.com>
se...@google.com <se...@google.com>
se...@google.com <se...@google.com> #8
I am having difficulty replicating this bug at head. Is there some additional context we can add here, devices or APIs where this is observed?
lo...@gmail.com <lo...@gmail.com> #9
se...@google.com <se...@google.com> #10
Levi are you familiar with similar nested scroll issues occuring with LazyColumn, and could you point us in the right direction in terms of proper nested scroll hierarchy setup here. It is difficult to diagnose given this doesn't consistently happen. Perhaps something to do with touch slop or as users have noted, conflicting animation times?
to...@gmail.com <to...@gmail.com> #11
The easy way to reproduce is fling up any scrollable content then press and drag down. Not necessarily a lazy column.
80% of the time the bottom sheet will be dragged down and not the scrollable content.
My current solution is to disable user drag when nested content can scroll down.
ni...@gmail.com <ni...@gmail.com> #12
I also observed that flinging up does not close the bottom sheet as often as scrolling slowly. Maybe something to do with scroll velocity.
fe...@gmail.com <fe...@gmail.com> #13
Can you elaborate on this as a workaround, I'm facing the same problem
> sometimes the bottom sheet also takes click events, causing the click listener on column item doesn't take effect
I can confirm this is also happening for me. And I can reproduce this consistently in my setup
to...@gmail.com <to...@gmail.com> #14
I'm using a local copy of M3 BottomSheet due to this and quite a few other issues with statusbar, theming and everything.
But mostly the sheetState have a disableNestedScroll and use it in the nestedScollConnection to ignore handling when true.
And then use a Composable to handle this depending on the case.
@Composable
fun NestedScrollStateHandler(navigator: BottomSheetNavigator, scrollState: ScrollState?) {
if (scrollState != null) {
val canScroll by remember { derivedStateOf { scrollState.canScrollBackward } }
navigator.disableNestedScroll(canScroll)
}
DisposableEffect(scrollState) {
onDispose {
navigator.disableNestedScroll(false)
}
}
}
There's other ways to handle this but it works :)
le...@google.com <le...@google.com> #15
Hi @serniebanders, the usage of nested scrolling seems fine, but this could be a gesture clashing issue. I wasn't able to reproduce it at head as well, though I could reproduce it in 1.3, so I believe this issue has been fixed already, in fact I wasn't able to reproduce it in 1.4.0-alpha01.
For reporter, please re-open the issue if you can reproduce it starting on 1.4.0-alpha01.
Thank you.
Description
Jetpack Compose version: 1.7.0-beta05 Material Library Version: M3 Material Compose component used: ModalBottomSheet
The ModalBottomSheet component in Material 3 Compose is not correctly handling nested scroll events when containing a scrollable component like LazyColumn. The sheet attempts to close even when the inner content hasn't been fully scrolled to the top, leading to a poor user experience.
Steps to Reproduce:
Expected Behavior: The ModalBottomSheet should not attempt to close until the contained LazyColumn has been scrolled to the top. Only when the list is at its top position should upward scroll gestures be captured by the sheet to initiate the closing action.
Actual Behavior:https://www.youtube.com/shorts/IAvMIOrX_jo
The ModalBottomSheet inconsistently captures upward scroll gestures even when the LazyColumn is not at the top, leading to premature dismissal attempts of the sheet. This creates a jarring user experience as the sheet may try to close while the user is still interacting with the list content.
Steps to Reproduce: