Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 8fbdce5

Browse files
committed
fix: hitting escape on initial page load toggles open empty sidecar
Fixes #4487
1 parent 8534267 commit 8fbdce5

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

packages/test/src/api/selectors.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export const TAB_SELECTED_N = (N: number) => `${TAB_N(N)}.visible`
44

55
export const SIDECAR_BASE = `${CURRENT_TAB} .kui--sidecar`
66
export const SIDECAR_FULLSCREEN = `${CURRENT_TAB} .kui--sidecar.visible.maximized:not(.minimized)`
7+
export const TERMINAL_WITH_SIDECAR_VISIBLE = `${CURRENT_TAB} .repl.sidecar-visible`
78
export const PROMPT_BLOCK = `${CURRENT_TAB} .repl .repl-block`
89
export const BOTTOM_PROMPT_BLOCK = `${CURRENT_TAB} .kui--input-stripe .repl-block`
910
export const BOTTOM_PROMPT = `${BOTTOM_PROMPT_BLOCK} input`

plugins/plugin-client-common/src/components/Views/Sidecar/BaseSidecar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ export abstract class BaseSidecar<
178178

179179
/** Escape key toggles sidecar visibility */
180180
private onEscape(evt: KeyboardEvent) {
181-
if (evt.key === 'Escape' && !document.getElementById('confirm-dialog') && !isPopup()) {
181+
if (evt.key === 'Escape' && !document.getElementById('confirm-dialog') && !isPopup() && this.current) {
182182
if (this.props.willChangeSize) {
183183
this.props.willChangeSize(this.props.width === Width.Closed ? this.defaultWidth() : Width.Closed)
184184
}

plugins/plugin-client-common/src/components/Views/Sidecar/TopNavSidecar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,9 @@ export default class TopNavSidecar extends BaseSidecar<MultiModalResponse, Histo
326326

327327
public render() {
328328
if (!this.current || !this.current.response) {
329-
return <div>hi</div>
329+
return <div />
330330
}
331+
331332
try {
332333
const breadcrumbs = [
333334
this.kindBreadcrumb(),

plugins/plugin-core-support/src/test/core/basic-functionality.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import * as assert from 'assert'
2323
import { Application } from 'spectron'
2424

25-
import { Common, CLI } from '@kui-shell/test'
25+
import { CLI, Common, Selectors, Keys } from '@kui-shell/test'
2626

2727
const APP_TITLE = process.env.APP_TITLE || 'Kui'
2828
// const CLI_PLACEHOLDER = process.env.CLI_PLACEHOLDER || 'enter your command'
@@ -57,6 +57,11 @@ Common.localDescribe('Basic Functionality', function(this: Common.ISuite) {
5757

5858
it('has an initial focus on the CLI prompt', () => assert.ok(this.app.client.hasFocus(selectors.PROMPT)))
5959

60+
it('should do nothing when hitting escape key', async () => {
61+
await this.app.client.keys(Keys.ESCAPE)
62+
await this.app.client.waitForExist(Selectors.TERMINAL_WITH_SIDECAR_VISIBLE, 2000, true)
63+
})
64+
6065
/* it('has the expected placeholder text in the CLI prompt', async () => {
6166
try {
6267
const attr = await this.app.client.getAttribute(selectors.PROMPT, 'placeholder')

0 commit comments

Comments
 (0)