diff --git a/public/app/features/dashboard-scene/scene/keyboardShortcuts.ts b/public/app/features/dashboard-scene/scene/keyboardShortcuts.ts index 57e8c73b0b2..c88a12788d9 100644 --- a/public/app/features/dashboard-scene/scene/keyboardShortcuts.ts +++ b/public/app/features/dashboard-scene/scene/keyboardShortcuts.ts @@ -43,7 +43,13 @@ export function setupKeyboardShortcuts(scene: DashboardScene) { keybindings.addBinding({ key: 'v', onTrigger: withFocusedPanel(scene, (vizPanel: VizPanel) => { - if (!scene.state.viewPanelScene) { + if (scene.state.viewPanelScene) { + locationService.push( + locationUtil.getUrlForPartial(locationService.getLocation(), { + viewPanel: undefined, + }) + ); + } else { const url = locationUtil.stripBaseFromUrl(getViewPanelUrl(vizPanel)); locationService.push(url); } @@ -178,7 +184,13 @@ export function setupKeyboardShortcuts(scene: DashboardScene) { const sceneRoot = vizPanel.getRoot(); if (sceneRoot instanceof DashboardScene) { const panelId = getPanelIdForVizPanel(vizPanel); - if (!scene.state.editPanel) { + if (scene.state.editPanel) { + locationService.push( + locationUtil.getUrlForPartial(locationService.getLocation(), { + editPanel: undefined, + }) + ); + } else { const url = locationUtil.stripBaseFromUrl(getEditPanelUrl(panelId)); locationService.push(url); }