slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
16.94k stars 568 forks source link

ListView items that are not visible are not focusable through tabbing. #4976

Closed sgued closed 5 months ago

sgued commented 5 months ago

Reproduce:

import { AboutSlint, Button, VerticalBox, ListView } from "std-widgets.slint";

component Test {
    in property <int> value;

    Rectangle {
        border-color: black;
        border-width: focus.has-focus ? 2px : 0px;
        Text {
            text: value;
        }
        focus := FocusScope { }
    }
}

export component Demo {
    property <[int]> model: [
        1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
    ];
    ListView {
        for i in model: Test {
            value: i;
        }
    }   
}

Make the view smaller so that everything doesn't fit. Then tabbing works to focus the various elements, until it is should focus an item outside of the visible range. Then instead of focusing the invisible item it focuses outside of the listview, or loops back.

ogoffart commented 5 months ago

Thanks for filling the issue.

There is already a similar issue in https://github.com/slint-ui/slint/issues/3067 so I'll close this one as a duplicate. But thanks anyway for reporting the bug.