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)
Attachment actions
Unintended behavior
View staffing
Description
Jetpack Compose version: BOM 2024.12.01
Jetpack Compose component(s) used: ScrollableState and lazy/scrollable containers, LocalBringIntoViewSpec
Android Studio Build: Android Studio Ladybug Feature Drop | 2024.2.2
Kotlin version: 2.0.0
When overriding
LocalBringIntoViewSpec
it would be useful to be able to scroll to an item and make it follow the spec defined byLocalBringIntoViewSpec
. Currently, usinganimateScrollToItem()
orscrollToItem()
will scroll so the item is at the start of the container, which doesn't look very fluid when the component is later focused as it will scroll again whenLocalBringIntoViewSpec
triggersIt's possible to call
BringIntoViewRequester#bringIntoView
after the scroll, but that doesn't really work that well for a few reasons:animateScrollToItem()
the animation of the scroll will finish and then the animation defined inLocalBringIntoViewSpec
will start. It's very visible that two steps are being done instead of one smooth scrollbringIntoView()
)It's probably possible to create some logic to find the offset needed and pass that to the
scrollOffset
parameter, but I'm not sure how easy it is to do this in a convenient and reusable wayThis is probably primarily an issue on Android TV
Example code (see also the attached video):