Thread
#compose
    Jordan Silva

    Jordan Silva

    1 year ago
    Hi, I’m trying to scroll a Column/LazyColumn using an external keyboard attached to my device, but I couldn’t. I tried everything with focusable and LocalFocusManager and I couldn’t find a way to navigate inside a scrollable column with an external keyboard. Here’s a simple code example. What I expect is to be able to navigate through the items using the arrow up/down on my keyboard.
    val list = (1..100).map { "Item $it" }
    LazyColumn {
        items(list) { item -> Text(text = item, modifier = Modifier.fillMaxWidth().padding(16.dp)) }
    }
    I tried using focusable for each Text Component, for Lazy Column, with Column. Trigger manually
    LocalFocusManager.current.moveFocus
    . Nothing works. 😐 Using custom components I could navigate until the end of the screen, but it doesn’t scroll the Column to the next element (outside the screen, not visible on the screen). Has anyone managed to do this - navigate all components in a List using an external keyboard?
    m

    mkrussel

    1 year ago
    I think you will need to remember and pass and scroll state to the lazy column. And then you can update that state to scroll to specific positions.
    Jordan Silva

    Jordan Silva

    1 year ago
    Hmm.. It is different. It just help to go directly to a specific item. My case is just going one by one using an external keyboard. With external keyboard I can’t even focus on the fist item of the list. 😐
    JulianK

    JulianK

    1 year ago
    I don't think keyboard support is there yet in compose, is it?
    Jordan Silva

    Jordan Silva

    1 year ago
    You're correct. I just checked the roadmap and says it is In Focus.https://developer.android.com/jetpack/androidx/compose-roadmap