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

Improve selection behaviours on SLC #373

Open
fscarponi opened this issue Apr 30, 2024 · 0 comments
Open

Improve selection behaviours on SLC #373

fscarponi opened this issue Apr 30, 2024 · 0 comments

Comments

@fscarponi
Copy link
Collaborator

fscarponi commented Apr 30, 2024

Screen recording of Swing list behaviour

So, I checked and the Swing behaviour is as follows:

  1. [Solved] When focusing a list, either the previous selection is kept, or the first item gets selected (if there is any item in the list)
  2. When the current selection is gone (e.g., item removed), the item above (i.e., selectedIndex - 1) is selected
  3. If the item was the first one, then the next one is selected (i.e., the selection remains on selectedIndex even if the item is now different)
  4. If there are no items left, the selection is null
  5. The selection can only be null when the list is empty, or if it has never received focus before

On multi-select lists, it pretty much follows the same rules. The only difference is that when there are multiple items selected and one of them disappears, the item also disappears from the selection, but other selected items remain selected. If all selected items are removed, the behaviour is the same as for the single-select list.

We should align to this behaviour. If the list is empty when it receives focus, it'll have no selection, but as soon as the user uses the keyboard to move the selection, a selection is created on the first item. If apps want to create a selection once they add data to the list, they're free to do so, but we won't do it for them.

Originally posted by @rock3r in #357 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant