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

Programmatically selecting an item in List should set it up to be the next-focused item #4472

Open
2 tasks done
williambrode opened this issue Dec 22, 2023 · 2 comments
Open
2 tasks done
Labels
information-needed Further information is requested unverified A bug that has been reported but not verified

Comments

@williambrode
Copy link
Contributor

Checklist

  • I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
  • This issue only relates to a single bug. I will open new issues for any other problems.

Describe the bug

If you create a list and then select a list item at the bottom for the user, then when they try to change to a new item in the list, it will jump back to the top of the list before selecting that item. This makes for a confusing UI experience, since no scroll should be needed (the item is visible).

The cause seems to be that the list item is not "focused" when we do list.Select(). So when the list itself is clicked - it resets to the focused item (0), then it focuses the item the user clicked on. We only set the focused item in the list when it is clicked - but shouldn't we also set it when we've selected that item for the user?

How to reproduce

list := NewList(...)
list.Select(id)

User then clicks an item in the list and it will adjust the scroll when its not necessary.

Screenshots

No response

Example code

list := NewList(...)
list.Select(id)

Fyne version

2.4.0

Go compiler version

1.19

Operating system and version

Windows 10

Additional Information

No response

@williambrode williambrode added the unverified A bug that has been reported but not verified label Dec 22, 2023
@dweymouth dweymouth changed the title When clicking a list item for the first time - scroll jumps back to item 0. Programmatically selecting an item in List should set it up to be the next-focused item Dec 22, 2023
williambrode added a commit to williambrode/fyne that referenced this issue Dec 22, 2023
williambrode added a commit to williambrode/fyne that referenced this issue Dec 22, 2023
@Jacalz Jacalz added the information-needed Further information is requested label Dec 22, 2023
@Jacalz
Copy link
Member

Jacalz commented Dec 22, 2023

Please always add example code per the guidelines in the issue template.

@thenick775
Copy link

Bump, I too would like to programmatically focus a list item in any capacity

williambrode added a commit to williambrode/fyne that referenced this issue Apr 26, 2024
williambrode added a commit to williambrode/fyne that referenced this issue Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
information-needed Further information is requested unverified A bug that has been reported but not verified
Projects
None yet
Development

No branches or pull requests

3 participants