From e7bdda6787e1afdc87babb31de8ac23281a59bb2 Mon Sep 17 00:00:00 2001 From: Jessica Koch Date: Fri, 25 Jan 2019 23:45:33 -0800 Subject: [PATCH] FIX keybindings were pointing to null events --- lib/core/src/client/preview/start.js | 4 ++-- lib/ui/src/containers/nav.js | 2 +- lib/ui/src/core/shortcuts.js | 6 +++--- lib/ui/src/settings/shortcuts.js | 2 +- lib/ui/src/settings/shortcuts.test.js | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/core/src/client/preview/start.js b/lib/core/src/client/preview/start.js index d231ab03f749..14f1b35e5ce8 100644 --- a/lib/core/src/client/preview/start.js +++ b/lib/core/src/client/preview/start.js @@ -200,9 +200,9 @@ export default function start(render, { decorateStory } = {}) { window.onkeydown = event => { if (!focusInInput(event)) { // We have to pick off the keys of the event that we need on the other side - const { altKey, ctrlKey, metaKey, shiftKey, key } = event; + const { altKey, ctrlKey, metaKey, shiftKey, key, code, keyCode } = event; channel.emit(Events.PREVIEW_KEYDOWN, { - event: { altKey, ctrlKey, metaKey, shiftKey, key }, + event: { altKey, ctrlKey, metaKey, shiftKey, key, code, keyCode }, }); } }; diff --git a/lib/ui/src/containers/nav.js b/lib/ui/src/containers/nav.js index 0fdd5e39150b..7ab1dab7a88c 100755 --- a/lib/ui/src/containers/nav.js +++ b/lib/ui/src/containers/nav.js @@ -49,7 +49,7 @@ const createMenu = memoize(1)( id: 'A', title: 'Toggle Navigation', action: () => api.toggleNav(), - detail: shortcutToHumanString(shortcutKeys.navigation), + detail: shortcutToHumanString(shortcutKeys.toggleNav), icon: showNav ? 'check' : '', }, { diff --git a/lib/ui/src/core/shortcuts.js b/lib/ui/src/core/shortcuts.js index 045a2fcf933d..623eb4ef4efe 100644 --- a/lib/ui/src/core/shortcuts.js +++ b/lib/ui/src/core/shortcuts.js @@ -11,7 +11,7 @@ export const defaultShortcuts = Object.freeze({ fullScreen: ['F'], togglePanel: ['S'], // Panel visibiliy panelPosition: ['D'], - navigation: ['A'], + toggleNav: ['A'], toolbar: ['T'], search: ['/'], focusNav: ['1'], @@ -94,7 +94,7 @@ export default function initShortcuts({ store }) { break; } - case 'focusSearch': { + case 'search': { if (isFullscreen) { fullApi.toggleFullscreen(); } @@ -181,7 +181,7 @@ export default function initShortcuts({ store }) { break; } - case 'toggleToolbar': { + case 'toolbar': { fullApi.toggleToolbar(); break; } diff --git a/lib/ui/src/settings/shortcuts.js b/lib/ui/src/settings/shortcuts.js index 08975dd6f436..e2c48e9719c4 100644 --- a/lib/ui/src/settings/shortcuts.js +++ b/lib/ui/src/settings/shortcuts.js @@ -31,7 +31,7 @@ const shortcutLabels = { fullScreen: 'Go full screen', togglePanel: 'Toggle panel', panelPosition: 'Toggle panel position', - navigation: 'Toggle navigation', + toggleNav: 'Toggle navigation', toolbar: 'Toggle toolbar', search: 'Focus search', focusNav: 'Focus navigation', diff --git a/lib/ui/src/settings/shortcuts.test.js b/lib/ui/src/settings/shortcuts.test.js index 47e6000f8d0d..dfe5afa3ebce 100644 --- a/lib/ui/src/settings/shortcuts.test.js +++ b/lib/ui/src/settings/shortcuts.test.js @@ -6,7 +6,7 @@ import ShortcutsScreen from './shortcuts'; const shortcutKeys = { fullScreen: ['F'], togglePanel: ['S'], - navigation: ['A'], + toggleNav: ['A'], toolbar: ['T'], search: ['/'], focusNav: ['1'],