Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX keybindings were pointing to null events #5375

Merged
merged 1 commit into from
Jan 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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