I'm going to ask what I feel like is a really dumb...
# compose-desktop
g
I'm going to ask what I feel like is a really dumb question. In a much more complex layout I'm trying to do the M3 collapsing app bar in a scaffold. It kept not working - the bar wouldn't collapse. I just made a test layout and dumbed it down to just a scaffold, a bar, and a scrollable list of text - and it still won't work. Am I missing something really obvious? I did also try with a lazycolumn just to rule that out and no difference. I've done this before without issue so I'm not sure what the problem is. Is there a bug in compose MP with the scaffold right now?
Copy code
val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior(rememberTopAppBarState())
    Scaffold (Modifier.nestedScroll(scrollBehavior.nestedScrollConnection),
        topBar = {
            TopAppBar(
                colors = topAppBarColors(
                    containerColor = MaterialTheme.colorScheme.background,
                    titleContentColor = MaterialTheme.colorScheme.onSurface,
                ),
                navigationIcon = {
                    IconButton(onClick = back) { Icon(Icons.Filled.ArrowBack, "Back") }
                },
                title = {
                    Text("Title")
                },
                scrollBehavior = scrollBehavior
            )

        }) { padding ->
        Column (modifier = Modifier.padding(padding).verticalScroll(rememberScrollState()).nestedScroll(scrollBehavior.nestedScrollConnection)) {
            (1..100).forEach {
                Text("Item $it")
            }
        }
    }
It does seem to be a compose desktop bug. I just fired up my app in an android emulator and it works as expected. Anyone else aware/able to replicate?
https://github.com/JetBrains/compose-multiplatform/issues/653 seems like it's this issue and it's fixed in 1.6
s
Did you ever get this working? I'm not sure if the fix landed yet or not. I'm also not sure that it will address the situation where someone uses a scrollbar. Is there a suggested way to handle that on desktop?
i
My fix was too late, it was after freezing for 1.6 release, but you can try the latest dev. The fix was about the mouse wheel, as far as I remember scroll bar triggered nested scroll callbacks already
s
The scrollbar doesn't trigger nested scroll callbacks. I'm using the example from the compose docs here: https://developer.android.com/reference/kotlin/androidx/compose/ui/input/nestedscroll/package-summary#(androidx.compose.ui.[…]estedScrollDispatcher) except the
LazyColumn
has a scrollbar. Want me to make a small reproducer for it and file a bug report? It not working isn't really a big deal for me. On desktop it actually doesn't look too bad if my header doesn't get hidden.
i
Want me to make a small reproducer for it
Reproduced it locally already, so no need for that. we already accumulated some issues regarding scroll bar - I'll just add this to that list
s
Thanks
a
I’d appreciate a reproducer for nested scrolling with scrollbar. I’m not really sure what the desired behavior is.
i
@Alexander Maryanovsky I'll share it to you
👍 1