Skip to content

fix(uity): support alt-jk sidebar navigation#92

Merged
bnema merged 1 commit into
mainfrom
feat/sidebar-alt-jk-navigation
Jun 21, 2026
Merged

fix(uity): support alt-jk sidebar navigation#92
bnema merged 1 commit into
mainfrom
feat/sidebar-alt-jk-navigation

Conversation

@bnema

@bnema bnema commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • Route Alt+j and Alt+k through sidebar navigation wherever j/k already move items.
  • Preserve existing plain j/k, J/K reorder, and Alt+h numeric toggle behavior.
  • Add regression coverage for realistic Alt key events, search navigation, and upward reorder.

Test Plan

  • go test ./internal/adapters/uity -count=1

Summary by CodeRabbit

  • New Features

    • Added Alt+J/K keyboard shortcuts for navigating the browse tree and project menu.
    • Enabled j/k key support for navigation while searching without affecting the search filter.
    • Added Shift+K shortcut to move selected items in the tree.
  • Tests

    • Added comprehensive keyboard navigation tests for sidebar functionality.

@coderabbitai

coderabbitai Bot commented Jun 21, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 50873ef4-28d9-464b-9cf9-392d8c296bec

📥 Commits

Reviewing files that changed from the base of the PR and between ad19309 and 74e45b0.

📒 Files selected for processing (3)
  • internal/adapters/uity/sidebar_model.go
  • internal/adapters/uity/sidebar_model_test.go
  • internal/adapters/uity/tree_render_test.go

📝 Walkthrough

Walkthrough

Introduces a shared navigationKeyDelta helper in sidebar_model.go that interprets down/up arrow and j/k keys, accepting non-zero modifiers only when Alt is present. The three sidebar mode handlers (updateSearchKey, updateMenuKey, updateBrowseKey) are updated to call this helper early and return, removing the duplicated switch cases. Tests are added for Alt+J/K navigation across browse/search/menu modes, plain j/k navigation in search mode, and Shift+K tree-item reordering.

Changes

Sidebar navigationKeyDelta refactor and tests

Layer / File(s) Summary
navigationKeyDelta helper and mode routing
internal/adapters/uity/sidebar_model.go
Adds navigationKeyDelta(msg tea.KeyPressMsg) (int, bool) that detects down/up arrow and j/k keys and filters out any non-zero modifier that does not include Alt. Replaces the explicit j/down and k/up switch cases in updateSearchKey, updateMenuKey, and updateBrowseKey with an early call to this helper routing into m.move or m.moveMenu.
Navigation tests and altKeyPress helper
internal/adapters/uity/sidebar_model_test.go, internal/adapters/uity/tree_render_test.go
Adds altKeyPress to synthesize Alt-modified key events. Adds TestSidebarModelAltJKNavigateBrowseSearchAndProjectMenu covering browse, search, and project-menu subtests with Alt+J/K. Adds TestSidebarModelPlainJKNavigateSearchWithoutMutatingFilter checking j/k navigation leaves the filter unchanged. Adds TestTreeSidebarKMovesSelectedTreeItemUpAndReloads asserting Shift+K calls MoveTreeItem with delta -1 and triggers a tree reload.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 Hop left, hop right, with j and k,
Alt held down keeps the filter at bay.
One helper rules the up and the down,
No duplicate cases to slow this town.
The tree reshuffles with Shift+K's call —
A tidy refactor, enjoyed by all! 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the main change: adding Alt+J/K sidebar navigation support. It directly aligns with the PR's primary objective.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/sidebar-alt-jk-navigation

Comment @coderabbitai help to get the list of available commands and usage tips.

@bnema bnema merged commit eec1701 into main Jun 21, 2026
4 checks passed
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.

1 participant