Skip to content

Fix behavior of 'g' key to return to aggregate view from top-level detail view, refine navigation docs#26

Merged
wesm merged 3 commits intomainfrom
nav-refinements
Nov 3, 2025
Merged

Fix behavior of 'g' key to return to aggregate view from top-level detail view, refine navigation docs#26
wesm merged 3 commits intomainfrom
nav-refinements

Conversation

@wesm
Copy link
Owner

@wesm wesm commented Nov 3, 2025

Fixes #21

wesm and others added 3 commits November 3, 2025 07:46
Previously, pressing 'g' from the detail view (when not drilled down) had no
effect, leaving users stuck without an intuitive way to return to aggregate
views. This made navigation inconsistent since 'g' works to cycle views in all
other contexts.

Now 'g' behaves like 'Escape' when in top-level detail view, restoring the
previous aggregate view from navigation history (or defaulting to Merchant
view). This provides a more intuitive navigation experience where 'g' always
helps you change views, and both 'g' and 'Escape' can return you from detail
to aggregate view.

Changes:
- Updated cycle_grouping() in state.py to handle detail view case
- Added two comprehensive tests for the new behavior
- Updated navigation docs to clarify both keys work from detail view

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
The hint bar in top-level detail view now shows "Esc/g=Group" instead of
"g=Group" to indicate that both keys can be used to return to an aggregate
view. This makes the UI more discoverable and consistent with the behavior
added in the previous commit.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Previously, pressing 'g' to cycle to Category view, then 'd' to detail view,
then 'g' or 'Esc' would incorrectly return to Merchant view instead of
Category view. This was because switch_to_detail_view() wasn't saving the
current aggregate view to navigation history.

Also refactored code to eliminate duplication:
- Added clear_drill_down_and_selection() helper method in state.py
- Replaced 5 instances of duplicated selection-clearing code
- Moved NavigationState import to top of file (no inline imports)

Changes:
- switch_to_detail_view() now saves navigation history from aggregate views
- Added clear_drill_down_and_selection() to consolidate repeated code
- Added 2 tests for navigation history behavior
- All 899 tests pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@wesm
Copy link
Owner Author

wesm commented Nov 3, 2025

cc @SamEdwardes

@wesm wesm merged commit 4ffbb84 into main Nov 3, 2025
7 checks passed
@wesm wesm deleted the nav-refinements branch November 3, 2025 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How should I get from "Detail View" to "Aggregate View"

1 participant