-
Notifications
You must be signed in to change notification settings - Fork 40
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
Tabbing into a selectableLazyColumn with no selections pre-made does not allow keyboard navigation #357
Comments
This behavior is a known issue in the swing feature pair. You can verify it in the IDE: when a "LazyColumnLike" component (such as the project tree) gains focus, the first item is selected. This allows you to navigate freely using arrow keys. The same applies to SLC if you set a selection either through clicking or programmatically. Why is the scenario of "selecting the first element" not desirable? However, nothing prevents the user from setting the selected element by manipulating the state during the construction of the list! Feel free to suggest any other solution! |
I think Swing selects the first visible item, or the last selected item, when a list gains focus. We should do the same thing. If the last selected item key doesn't exist anymore, I'd select the first visible one. I think that's what Swing does (but will double check). I agree with Yasser that focusing the component should allow you to keyboard navigate immediately |
So, I checked and the Swing behaviour is as follows:
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. |
I agree with the proposed solution. Thanks for the investigation! |
@fscarponi please look into this when you have time 🙏 |
Hi Folks, |
@fscarponi The only thing on my end needed ASAP is the ability to tab into the |
#372 add an hotfix for the point 1
to implement other behaviors is possible but requires more investigations, keeping this state easily savable and consistent. |
If the user has not selected anything from a
SelectableLazyColumn
, and navigates to theSelectableLazyColumn
using tab, then the arrow keys do not seem to be detected. I was able to reproduce this issue by using the ide-sample's Compose Panel tab's list of releases as theSelectableLazyColumn
.Note: this has been encountered with #347 merged.
The text was updated successfully, but these errors were encountered: