Description
Every time refresh_data() runs, all DashPanel content is replaced via set_content(), which resets the scroll position to the top. If a user has scrolled halfway through a news feed, a background refresh jumps them back to the top.
Implementation:
- Before
set_content(), savepanel.scroll_y(orpanel.scroll_offset) - After
set_content()(which replaces theStatic), restore the saved scroll position viapanel.scroll_to(y=saved_y, animate=False) - Only restore if the new content height ≥ saved scroll position (avoid restoring to a position that no longer exists after content shrinks)
- Apply to all
DashPanelinstances
Acceptance Criteria
- #1 Scroll position is maintained across automatic background refreshes
- #2 Manual r refresh also preserves scroll
- #3 Scroll resets to top when the panel's source kind changes or content is significantly shorter
- #4 No visible scroll jump during updates