arkui

Scroll

Keeping the cursor on screen, and back to the top when the lit tab is chosen again.

Desktop

arkui::scroll

scroll::reveal keeps the cursor on screen as j and k walk past the edge of a list.

arkui::scroll

Keeping a keyboard cursor on screen.

rust/arkui/src/scroll.rs

Mobile

Asking for the latest capture…

Recording · A long list scrolled down, then asked to go to its top.

Where

  • ui/Tabs.kt: ScrollsToTop

How

  • ScrollsToTop(listState) or ScrollsToTop(gridState) inside a tab's page: a Reselect scrolls it home.

Asking for the latest capture…

Recording · A long list scrolled down, then asked to go to its top.

Where

  • The system's: TabView with a NavigationStack per tab

How

  • Nothing to add: the shown tab, tapped again, takes its stack back to its root and then its list to the top.
  • To do it from code, ScrollViewReader's scrollTo(first, anchor: .top) inside withAnimation(Springs.move). The recording sets a ScrollPosition a frame at a time along Springs.move's curve, which plays the same.

Asking for the latest capture…

Android · Recording · A long list scrolled down, then asked to go to its top.

Asking for the latest capture…

iOS · Recording · A long list scrolled down, then asked to go to its top.