Help me figure out whether this is a bug or intend...
# compose
a
Help me figure out whether this is a bug or intended. • On Android, I can continue dragging a list even after its content is fully scrolled, and i keep receiving
NestedScrollConnection
events (see 1st video) • On Desktop however, I don't receive any events when i overscroll (see video in 🧵). I need this to be consistent because I am building bottom sheets and users cannot currently collapse them on desktop using the mousewhee/trackpad. The current behavior is so weird for UX and doesn't feel I (the dev) need to handle this a different way. If this somehow a limitation of the platform, the web platform (Compose) handles it the same way. But on macs, desktop lists do bounce (overscroll effect) and websites (html) bounce as well.
Videos: Desktop, Chrome Mac
Code:
Copy code
@Composable
fun MinimalNestedScrollBugRepro() {
    // Minimal reproducible example for nested scroll bug
    // Issue: On desktop with mouse wheel, scrolling down doesn't work when at fully expanded state
    // Works fine on Android touch

    val density = LocalDensity.current

    var totalDelta by remember { mutableStateOf(0f) }

    val nestedScrollConnection = remember {
        object : NestedScrollConnection {
            override fun onPreScroll(available: Offset, source: NestedScrollSource): Offset {
                if (source != NestedScrollSource.UserInput) return Offset.Zero

                totalDelta += available.y

                return Offset.Zero
            }
        }
    }

    Box(
        Modifier
            .fillMaxSize()
            .safeDrawingPadding()
            .background(Color(0xFFEEEEEE))
    ) {
        Text("Total delta = $totalDelta", modifier = Modifier.padding(16.dp))
        // Sheet
        Column(
            Modifier
                .align(Alignment.BottomCenter)
                .height(600.dp)
                .nestedScroll(nestedScrollConnection)
                .verticalScroll(rememberScrollState())
                .padding(16.dp)
        ) {
            repeat(100) { index ->
                Box(
                    Modifier
                        .fillMaxWidth()
                        .height(60.dp)
                        .background(Color.LightGray, RoundedCornerShape(8.dp))
                        .padding(16.dp)
                ) {
                    Text("Item $index")
                }
                Spacer(Modifier.height(8.dp))
            }
        }
    }
}
a
I think there's two lenses here to look at the problem: which platform you're running on, and which input device you're using. Touchscreen, touchpad, and mouse wheel are all different types of input devices as they relate to creating a scrolling action, and it quickly becomes a UX question there. On macOS, I see overscroll behavior a lot of the time for touchpad scrolling, but not with a physical mouse wheel
So when comparing across platforms, I'd make sure to compare with the same input type - compare touchscreen behavior on Android with touchscreen behavior on desktop/Web, same for touchpad, and same for physical mouse wheel
a
i agree that the input type is important. However I expect the API to respond the same way from interactions of the same input type. ie if i can expand a bottom sheet using the trackpad on my mac, i should be able to collapse it the same way as well