Skip to content

fix(desktop): expand collapsed sections when cycling workspaces via keyboard#3848

Merged
saddlepaddle merged 1 commit intomainfrom
meta-arrow-expand-section
May 1, 2026
Merged

fix(desktop): expand collapsed sections when cycling workspaces via keyboard#3848
saddlepaddle merged 1 commit intomainfrom
meta-arrow-expand-section

Conversation

@saddlepaddle
Copy link
Copy Markdown
Collaborator

@saddlepaddle saddlepaddle commented Apr 29, 2026

Summary

  • ⌘⌥↑/⌘⌥↓ (and the ⌘1..9 jumps) cycle through every workspace in the sidebar, but if the destination workspace lived inside a collapsed project or section the row stayed hidden — you'd land on a workspace you couldn't see.
  • Build a workspaceId → { project, section, collapse state } map from the sidebar groups and toggle any collapsed parents open right before navigation.

Test plan

  • Collapse a section that contains the next workspace; press ⌘⌥↓ — section expands and the new workspace is highlighted.
  • Collapse a project that contains the next workspace; press ⌘⌥↑/↓ — project expands and the new workspace is visible.
  • ⌘1..⌘9 jumps to a workspace inside a collapsed project/section also expand the parents.
  • Cycling between workspaces whose parents are already expanded doesn't re-toggle them.

Summary by cubic

Expands collapsed projects/sections when navigating to a workspace via ⌘⌥↑/↓ or ⌘1..9 so the destination is always visible in the sidebar.

  • Bug Fixes
    • Map each workspace to its parent project/section and collapse state from sidebar groups.
    • Toggle collapsed parents before navigating using useDashboardSidebarState (no re-toggle if already expanded).

Written for commit ff27e23. Summary will update on new commits. Review in cubic

Summary by CodeRabbit

  • Bug Fixes
    • Improved keyboard navigation in the dashboard sidebar. When navigating between workspaces using keyboard shortcuts, collapsed sections now automatically expand to reveal the destination workspace, eliminating the need for manual expansion.

…eyboard

Meta+Alt+Up/Down (and the ⌘1..9 jump shortcuts) cycle through every
workspace in the sidebar regardless of collapse state, but the
destination row stayed hidden when its parent project or section was
collapsed. Toggle the collapsed parents open before navigating so the
focused workspace is visible.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 24f5b5c7-ccef-48ec-b4c2-905b82d9ea24

📥 Commits

Reviewing files that changed from the base of the PR and between 35a2777 and ff27e23.

📒 Files selected for processing (1)
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/hooks/useDashboardSidebarShortcuts/useDashboardSidebarShortcuts.ts

📝 Walkthrough

Walkthrough

Enhanced keyboard navigation in the dashboard sidebar by adding automatic workspace reveal functionality. When users navigate via hotkeys or direct selection, collapsed parent sections and projects now automatically expand to display the destination workspace in the UI.

Changes

Cohort / File(s) Summary
Keyboard Navigation Enhancement
apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/hooks/useDashboardSidebarShortcuts/useDashboardSidebarShortcuts.ts
Integrated useDashboardSidebarState hook and added revealWorkspace callback that constructs a workspace ID to collapse-state lookup map. Updated switchToWorkspace handler and PREV_WORKSPACE/NEXT_WORKSPACE hotkey handlers to invoke revealWorkspace before navigating, automatically expanding collapsed project and section containers to reveal the target workspace.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 A rabbit hops through nested trees,
Where workspaces hide with graceful ease,
With keyboard flicks and magic new,
Collapsed containers pop in view!
Navigation swift, no sight to lose—
The perfect path the rabbit choose! 🥕✨

🚥 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
Title check ✅ Passed The title accurately describes the main change: expanding collapsed sections when cycling through workspaces via keyboard shortcuts.
Description check ✅ Passed The description covers the problem, solution, and detailed test plan. While missing the formal template structure, it provides comprehensive context about the changes.
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 meta-arrow-expand-section

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

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

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 29, 2026

Greptile Summary

This PR fixes a UX bug where navigating to a workspace via keyboard shortcuts (⌘⌥↑/⌘⌥↓, ⌘1–9) would land on a workspace that remained visually hidden inside a collapsed project or section. The fix builds a workspaceId → { project, section, collapse state } map and calls revealWorkspace before navigation to expand any collapsed ancestors.

Confidence Score: 5/5

Safe to merge — logic is correct, toggle guards prevent spurious state flips, and all shortcut paths are covered.

No P0 or P1 findings. The workspaceLocations memo is correctly derived from the reactive groups prop so collapse-state snapshots are always fresh at call time. The guard checks prevent the toggle functions from firing on already-expanded ancestors.

No files require special attention.

Important Files Changed

Filename Overview
apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/hooks/useDashboardSidebarShortcuts/useDashboardSidebarShortcuts.ts Adds workspaceLocations memo and revealWorkspace callback to expand collapsed project/section ancestors before keyboard-shortcut navigation; logic is sound and toggle guards are correct.

Sequence Diagram

sequenceDiagram
    participant User
    participant Hotkey as useHotkey (NEXT/PREV/JUMP)
    participant Hook as useDashboardSidebarShortcuts
    participant Locations as workspaceLocations (memo)
    participant State as useDashboardSidebarState
    participant Router as navigateToV2Workspace

    User->>Hotkey: ⌘⌥↓ / ⌘1..9
    Hotkey->>Hook: switchToWorkspace(index) or prev/next handler
    Hook->>Locations: get(workspaceId) → { projectIsCollapsed, sectionId, sectionIsCollapsed }
    alt project is collapsed
        Hook->>State: toggleProjectCollapsed(projectId)
        State-->>Hook: project.isCollapsed = false
    end
    alt section exists and is collapsed
        Hook->>State: toggleSectionCollapsed(sectionId)
        State-->>Hook: section.isCollapsed = false
    end
    Hook->>Router: navigateToV2Workspace(workspaceId, navigate)
    Router-->>User: workspace visible + highlighted
Loading

Reviews (1): Last reviewed commit: "fix(desktop): expand collapsed sections ..." | Re-trigger Greptile

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@saddlepaddle saddlepaddle merged commit 9cf2b8f into main May 1, 2026
7 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ⚠️ Neon database branch

Thank you for your contribution! 🎉

@Kitenite Kitenite deleted the meta-arrow-expand-section branch May 6, 2026 04:52
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