Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto hide thumb does not work #25

Closed
benjdero opened this issue Oct 7, 2024 · 4 comments
Closed

Auto hide thumb does not work #25

benjdero opened this issue Oct 7, 2024 · 4 comments
Labels
bug Something isn't working contribution candidate Issue is a good candidate for external contribution

Comments

@benjdero
Copy link

benjdero commented Oct 7, 2024

HideWhileIdle seems to do nothing as the thumb always stay visible.

val listState: LazyListState = rememberLazyListState()
val state: ScrollAreaState = rememberScrollAreaState(listState)
ScrollArea(
    overscrollEffect = null,
    state = state
) {
    LazyColumn(
        modifier = modifier.then(
            Modifier.fillMaxHeight()
        ),
        state = listState
    ) {
        items(itemList) { item: Item ->
            ItemView(
                item = item,
                onItemClick = onItemClick
            )
        }
    }
    VerticalScrollbar(
        modifier = Modifier
            .align(Alignment.TopEnd)
            .fillMaxHeight()
            .width(6.dp)
    ) {
        Thumb(
            modifier = Modifier.background(Color.LightGray),
            thumbVisibility = ThumbVisibility.HideWhileIdle(
                enter = fadeIn(),
                exit = fadeOut(),
                hideDelay = 0.5.seconds
            )
        )
    }
}
@benjdero
Copy link
Author

benjdero commented Oct 7, 2024

The problem seems to be there:

delay(thumbVisibility.hideDelay)

If the user is still scrolling when the delay end (because he never stopped scrolling, or because he stopped but started scrolling again). Then the scrollbar will never disappear.

@alexstyl alexstyl added bug Something isn't working contribution candidate Issue is a good candidate for external contribution labels Oct 7, 2024
@alexstyl
Copy link
Member

alexstyl commented Oct 7, 2024

Should be rather straightforward to fix. If you feel like contributing, go for it

@benjdero
Copy link
Author

benjdero commented Oct 7, 2024 via email

alexstyl pushed a commit that referenced this issue Oct 14, 2024
* add isDraggingList as LaunchedEffect param in ScrollbarScope.Thumb

* fix scrollbar not disappearing on desktop
@alexstyl
Copy link
Member

Fixed as part of #26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working contribution candidate Issue is a good candidate for external contribution
Projects
None yet
Development

No branches or pull requests

2 participants