Tab State Preservation Across Navigation Events
Using StatefulShellRoute, each bottom navigation tab must preserve its full scroll position, selected item, and sub-navigation stack when the user switches to another tab. For peer mentors with cognitive disabilities or those mid-task (e.g., reviewing a contact while adding an activity), losing position creates disorientation and forces re-work. The tab state manager must persist state in memory for the session and restore it instantly on return without visible re-loading.
User Story
Acceptance Criteria
- Given I have scrolled halfway down the Contacts list, when I switch to the Home tab and then return to Contacts, then the list is scrolled to the same position without reloading
- Given I have navigated to a contact detail screen within the Contacts tab, when I switch to the Notifications tab and return to Contacts, then the contact detail screen is still displayed
- Given I am using a screen reader and return to a previously visited tab, when the tab regains focus, then the focus is restored to the element I last interacted with
- Given the app goes to background and returns to foreground within the same session, when I inspect each tab, then all tab states are preserved
- Given I explicitly tap a bottom nav tab that I am already on, when the tap is received, then the tab scrolls to the top or returns to its root screen as an intentional reset action
Business Value
Cognitive accessibility is a top priority for NHF, whose peer mentors include stroke survivors and individuals with cognitive challenges. Losing navigation state forces users to restart mental tasks, increasing cognitive load and error rates. State preservation directly supports WCAG 2.2 Success Criterion 3.2.3 (Consistent Navigation) and reduces task abandonment, which is the primary driver of underreporting identified in all three organization workshops.
Components
- Tab State Manager service
- Navigation State Repository data
- Navigation Route Configuration infrastructure
- Navigation Accessibility Service service