JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
16.27k stars 1.18k forks source link

HorizontalPager doesn't snap to new page when tab-navigation focuses an element on a different page #4689

Closed zacharee closed 1 month ago

zacharee commented 6 months ago

Describe the bug It doesn't look like the pager state knows about keyboard navigation, or what to do when an element on a different page becomes focused. Instead of snapping, it acts as if no scroll happened.

Affected platforms

Versions

To Reproduce

  1. Create a HorizontalPager with multiple pages that have focusable elements.
  2. Use the tab key to start navigating through them.
  3. When an element on another page is focused, the pager will scroll to bring it into focus, but won't snap the whole page into place.

Expected behavior The pager state should snap the page with the focused element into place.

Screenshots https://github.com/JetBrains/compose-multiplatform/assets/9020352/f546b755-99ec-498c-b0d0-5788942b5531

okushnikov commented 4 months ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.