Make chrome header navigation buttons draggable with keyboard shortcuts following slot positions #10719
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR implements draggable navigation buttons in the chrome header sidebar, allowing users to customize the order of the Workspace, Branches, History, and Codegen buttons. The keyboard shortcuts (Cmd+1 through Cmd+4) are assigned to slot positions rather than specific buttons, ensuring that the shortcuts always trigger the button in the corresponding position regardless of which button it is.
Motivation
Users have different workflows and preferences for which navigation views they access most frequently. By allowing them to reorder the buttons, they can optimize their workspace layout and ensure their most-used views are accessible via Cmd+1 and Cmd+2.
Changes
UI State Management
navButtonOrder: string[]
property toGlobalUiState
to persist button order['workspace', 'branches', 'history', 'codegen']
ChromeSidebar Component
Refactored the button rendering from hardcoded individual buttons to a configuration-based approach:
Before:
After:
Key Implementation Details
Dynamic Hotkey Assignment: Hotkeys are assigned as
⌘${index + 1}
based on the button's position in the rendered order, not its type. This means if a user moves History to the first position, Cmd+1 will open History.Proper Index Mapping: The drag-and-drop logic correctly maps visual indices (position in the UI) to button IDs in the saved order, handling edge cases like:
Visual Feedback: Added CSS transitions and states for drag operations:
grab
on hover,grabbing
while draggingExample Usage
A user can now:
Testing
Manual testing should verify:
Technical Notes
'workspace' | 'branches' | 'history' | 'codegen'
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.