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

Focus on StandardListView isn't visible #3548

Closed
FireFragment opened this issue Sep 26, 2023 · 3 comments · Fixed by #4086
Closed

Focus on StandardListView isn't visible #3548

FireFragment opened this issue Sep 26, 2023 · 3 comments · Fixed by #4086
Assignees
Labels
a:widgets Implementation of widgets (from std-widgets.slint) and their styles (mF,bS)

Comments

@FireFragment
Copy link

FireFragment commented Sep 26, 2023

Focused StandardListView is indistinguishable from an unfocused one, making it impossible to tell, whether a list is focused. This happens with all three styles (fluent, material, and native).

Video

Here is a video of how the code below behaves:

Slint.focus.mp4

To reproduce

Launch the following code and repeatedly press the TAB key. You can see, that buttons and checkbox are highlighted correctly when focused, while the list is not.


import { Button, CheckBox, VerticalBox, StandardListView, HorizontalBox} from "std-widgets.slint";
export component Test {
    height: 250px;
    VerticalBox {
        StandardListView {
            model: [
                {text: "Item 1"},
                {text: "Item 2"},
                {text: "Item 3"},
            ];
        }
        HorizontalBox {
            Button {
                text: "Button 1";
            }
            Button {
                text: "Button 2";
            }
            Button {
                text: "Button 3";
            }
        }
        CheckBox {
            text: "A checkbox";
        }
    }
}

Launch on SlintPad

Platform: KDE, Linux, X11

@ogoffart ogoffart added the a:widgets Implementation of widgets (from std-widgets.slint) and their styles (mF,bS) label Sep 27, 2023
@FloVanGH
Copy link
Member

@FireFragment thank you very much for your report. That's true at the moment a visual focus state for the StandardListView is missing.

@FloVanGH FloVanGH self-assigned this Sep 29, 2023
@FloVanGH
Copy link
Member

Behavior regarding to the design specifications:

Fluent (Windows winui)

On fluent on a focused ListView the first item got a focus border. The border can be moved down by array down and up by arrow down. To change selection you have to press enter on the focused ListView.

Cupertino (macOS)

There is no dedicated visual representation of a focused ListView. Behavior on a focused ListView is arrow down, selects the next item, arrow up selects previous item.

Material (Android)

On material ListView does not have a focus state, instead by press tab the next item in the list is focused. On enter the item got selected.

@FloVanGH
Copy link
Member

I would like to implement the fluent focus behavior for all styles to have a common behavior. But I have one problem if the ListView got focus the focus should be set on the first item and the ListView should scroll to it if it is not visible. But for this I need to detect when the ListView got focus, for this I would need something like a on-got-focus event / callback or a property change handler for has-focus #112.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:widgets Implementation of widgets (from std-widgets.slint) and their styles (mF,bS)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants