Skip to content

Commit 2ed7b7d

Browse files
authored
feat: Simplify workspace navigation flow (#126)
Fixes part of #101 Fixes #89 This change removes the need for using enter and escape to enable keyboard navigation when the workspace is focused. Instead, simply focusing the workspace is sufficient to allow keyboard navigation. Note that this PR goes back to the previous behavior of always enabling keyboard navigation on page load and instead limits the preconditions of navigation keys to check focus rather than feature enabled state. This allows for #89 to be fully mitigated. Since keyboard navigation is never disabled, the cursor position is never lost (and thus doesn't need to be cached). The removal of enter/escape fixes the first part of #101. This PR also performs some other minor cleanup work in ``navigation_controller.ts``.
1 parent 690103c commit 2ed7b7d

File tree

3 files changed

+82
-134
lines changed

3 files changed

+82
-134
lines changed

src/constants.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export enum SHORTCUT_NAMES {
2828
IN = 'in',
2929
OUT = 'out',
3030
INSERT = 'insert',
31-
ENTER_OR_MARK = 'enter_or_mark',
31+
MARK = 'mark',
3232
DISCONNECT = 'disconnect',
3333
TOOLBOX = 'toolbox',
3434
EXIT = 'exit',
@@ -51,7 +51,6 @@ export enum SHORTCUT_NAMES {
5151
CONTEXT_OUT = 'context_out',
5252
CONTEXT_IN = 'context_in',
5353
CLEAN_UP = 'clean_up_workspace',
54-
INTERCEPT_TAB = 'intercept_tab_navigation',
5554
}
5655

5756
/**

src/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ export class KeyboardNavigation {
2525
const navigationController = new NavigationController();
2626
navigationController.init();
2727
navigationController.addWorkspace(workspace);
28-
// Turns on keyboard navigation.
29-
navigationController.setHasAutoNavigationEnabled(true);
28+
navigationController.enable(workspace);
3029
navigationController.listShortcuts();
3130

3231
this.setGlowTheme();

0 commit comments

Comments
 (0)