Skip to content

Commit

Permalink
FIX keybindings were pointing to null events
Browse files Browse the repository at this point in the history
  • Loading branch information
Jessica-Koch committed Jan 26, 2019
1 parent 6914e6b commit e7bdda6
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/core/src/client/preview/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
});
}
};
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/src/containers/nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' : '',
},
{
Expand Down
6 changes: 3 additions & 3 deletions lib/ui/src/core/shortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down Expand Up @@ -94,7 +94,7 @@ export default function initShortcuts({ store }) {
break;
}

case 'focusSearch': {
case 'search': {
if (isFullscreen) {
fullApi.toggleFullscreen();
}
Expand Down Expand Up @@ -181,7 +181,7 @@ export default function initShortcuts({ store }) {
break;
}

case 'toggleToolbar': {
case 'toolbar': {
fullApi.toggleToolbar();
break;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/src/settings/shortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/src/settings/shortcuts.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ShortcutsScreen from './shortcuts';
const shortcutKeys = {
fullScreen: ['F'],
togglePanel: ['S'],
navigation: ['A'],
toggleNav: ['A'],
toolbar: ['T'],
search: ['/'],
focusNav: ['1'],
Expand Down

0 comments on commit e7bdda6

Please sign in to comment.