azavea / fb-gender-survey-dashboard

Interactive exploration of global results from the Facebook "Survey on Gender Equality At Home
https://gender-survey-dashboard.netlify.app/
Apache License 2.0
2 stars 2 forks source link

Persist checkbox state #35

Closed mmcfarland closed 3 years ago

mmcfarland commented 3 years ago

Overview

When returning to the geography selector page, check the boxes that are represented in current state. Additionally, use local state to track the previous "geo selection mode" selected values, so they can be restored when that mode is re-enabled. Prevent both regions and countries from being selected at once.

When navigating back to the question page (from the viz page), select any checkboxes that match the currently selected state. Additionally, expand any category accordions which have selected checkboxes.

Lastly, now that the user can navigate backwards, it was possible to go from Viz (with questions already selected) back to Geography, and then next to Questions again. This would leave the previously selected questions checked, causing the user to have to manually adjust them. It's not clear which use case we should support (clear them out or save them, either is a convenience depending on the user intent). This commit clears the selection before navigating forwards, but can be removed if the opposite behavior is better received. I think this approach is less error-prone, since the user could have changed the geometry selection mode (e.g., from region --> country) which would invalidate any previously selected questions (since there isn't 100% overlap between region and country questions).

Connects #11

Testing Instructions