Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Attachment actions
Description
Jetpack Compose component(s) used: LazyList (using key) / Row (& Column) with key
Android Studio Build: Build #AI-242.23339.11.2421.12550806
Kotlin version: 2.0.0
Steps to Reproduce or Code Sample to Reproduce:
1. Having a LazyList with focusable elements
2. Provide a key parameter when using LazyListScope.items
3. Delete focused element
4. Focus is reset => Focus will jump to the first focusable element of the screen. If the LazyList if not the first focusable group, focus will go out of the LazyList.
Expected behavior:
- There should be a way to choose where the focus goes when focused item is removed from inside a LazyList, so focus is not reset to screen initial focus.
Please note:
- If a Row is used rather than a LazyRow, or if the key parameter is not specified, the focus is given to the next element. If the deleted element is the last one, the focus is also reset.
- Using a focusRestorer in the LazyList does not prevent the focus from being lost.
- Configuring the focusProperties.exit does not fix the issue, since it is not called when focused item is removed.
- Not using the key parameter is not a solution since in my real case focused item can either be deleted, or moved to first index while keeping focus (which works well with the key parameter of items, but does not work while not using the key parameter)
All scenarios can be found in attached file