feat(dockview-core): spatial keyboard group focus + focus-logic refactor#1320
Merged
Conversation
Add Ctrl+Shift+Arrow to focus the group geometrically in that direction, complementing the sequential F6 / Shift+F6 cycle. From the active group's centre, picks the nearest grid group that sits predominantly along the requested axis (so 'left' ignores a group that's mostly above/below), then sets it active and lands focus on its content. Four more rebindable keymap entries: focusGroupLeft / Right / Up / Down. Defaults use Ctrl+Shift+arrows to dodge the macOS Spaces (Ctrl+arrow) and in-text word-nav (Alt+arrow) conflicts; rebind via keymap as needed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…Service The focusX host methods carried real feature logic (gridview traversal, spatial geometry, focus retention) inside the already-large DockviewComponent. Move it into AccessibilityService, where keyboard navigation belongs, and shrink the host to a narrow primitive surface: the component now exposes only `adjacentGroup(group, reverse)` (the gridview-order traversal that genuinely needs grid internals) plus the existing `activeGroup`. The service drives tab switching, group cycling, spatial focus and focus retention via the public group API (group.model.moveToNext/focusContent, group.api.setActive). Net: ~90 lines of logic out of dockviewComponent.ts, ~20 in. Behaviour unchanged — the keydown-based tests pass as-is. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Builds on the keyboard navigation landed in #1319.
Spatial (directional) group focus
Adds
Ctrl+Shift+Arrowto move focus to the group geometrically in that direction, complementing the sequentialF6/Shift+F6cycle. From the active group's centre it picks the nearest grid group sitting predominantly along the requested axis (soleftignores a group that's mostly above/below), then activates it and lands focus on its content.Four more rebindable keymap entries:
focusGroupLeft/focusGroupRight/focusGroupUp/focusGroupDown. Defaults useCtrl+Shift+arrowsto dodge the macOS Spaces (Ctrl+arrow) and in-text word-nav (Alt+arrow) conflicts.Refactor: focus logic moved out of DockviewComponent
The
focusXhost methods carried real feature logic (gridview traversal, the geometry math, focus retention) inside the already-largeDockviewComponent. Moved intoAccessibilityServicewhere keyboard navigation belongs; the host now exposes onlyadjacentGroup(group, reverse)— the one piece that genuinely needs grid internals — plus the existingactiveGroup. The service drives tab switching, group cycling, spatial focus and focus retention via the public group API.Net: ~90 lines of logic out of
dockviewComponent.ts, ~20 in. Behaviour unchanged.Tests
1086 passing. Spatial geometry covered via mocked
getBoundingClientRect(a 2x2 grid; jsdom has no layout); focus retention asserted by spying onfocusContent.🤖 Generated with Claude Code