From 2d795a7782af8c51e7ceb8b00683ed81cdc55422 Mon Sep 17 00:00:00 2001 From: abose Date: Sun, 22 Dec 2024 11:31:27 +0530 Subject: [PATCH 1/2] fix: escape key toggles panels when code hints popup is present --- src/view/WorkspaceManager.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/view/WorkspaceManager.js b/src/view/WorkspaceManager.js index bfab7b05d2..839104ff7c 100644 --- a/src/view/WorkspaceManager.js +++ b/src/view/WorkspaceManager.js @@ -520,7 +520,8 @@ define(function (require, exports, module) { // handled by the inline widget itself first. return; } - if(focussedEditor.canConsumeEscapeKeyEvent()){ + const dropdownOpen = $(".dropdown.open").is(":visible"); + if(dropdownOpen || focussedEditor.canConsumeEscapeKeyEvent()){ return; } From d37490b33b6adda1499a11f11f31bf2ceaa3422b Mon Sep 17 00:00:00 2001 From: abose Date: Mon, 23 Dec 2024 14:22:13 +0530 Subject: [PATCH 2/2] test: integ for escape key should not toggle panel if code hints popup visible --- src/features/ParameterHintsManager.js | 2 +- test/spec/MainViewManager-integ-test.js | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/features/ParameterHintsManager.js b/src/features/ParameterHintsManager.js index dc6c5fe655..65a15f5f47 100644 --- a/src/features/ParameterHintsManager.js +++ b/src/features/ParameterHintsManager.js @@ -231,11 +231,11 @@ define(function (require, exports, module) { * */ function dismissHint(editor) { + popupShown = false; if (hintState.visible) { $hintContainer.hide(); $hintContent.empty(); hintState = {}; - popupShown = false; if (editor) { editor.off("cursorActivity.ParameterHinting", handleCursorActivity); diff --git a/test/spec/MainViewManager-integ-test.js b/test/spec/MainViewManager-integ-test.js index 8ffd444ee4..7f443641a8 100644 --- a/test/spec/MainViewManager-integ-test.js +++ b/test/spec/MainViewManager-integ-test.js @@ -19,7 +19,7 @@ * */ -/*global describe, beforeEach, beforeAll, afterAll, afterEach, it, expect, awaitsForDone, spyOn, jasmine, Phoenix */ +/*global describe, beforeEach, beforeAll, afterAll, it, expect, awaitsForDone, spyOn, jasmine, awaitsFor */ define(function (require, exports, module) { @@ -1009,6 +1009,28 @@ define(function (require, exports, module) { expect(WorkspaceManager.removeEscapeKeyEventHandler("x")).toBeTrue(); }); + it("should not dismiss any panel if codehints are visible", async function () { + panel1.show(); + panel2.hide(); + expect(panel1.isVisible()).toBeTrue(); + + expect(MainViewManager.getActivePaneId()).toEqual("first-pane"); + promise = MainViewManager._open(MainViewManager.FIRST_PANE, FileSystem.getFileForPath(testPath + "/test.js")); + await awaitsForDone(promise, "MainViewManager.doOpen"); + let editor = EditorManager.getActiveEditor(); + editor.setCursorPos(0, 0); + await awaitsForDone(CommandManager.execute(Commands.SHOW_CODE_HINTS)); + await awaitsFor(function () { + return testWindow.$(".codehint-menu").is(":visible"); + }, "codehints to be shown"); + + SpecRunnerUtils.simulateKeyEvent(KeyEvent.DOM_VK_ESCAPE, "keydown", _$("#editor-holder")[0]); + await awaitsFor(function () { + return !testWindow.$(".codehint-menu").is(":visible"); + }, "codehints to be dismissed on escape press"); + expect(panel1.isVisible()).toBeTrue(); + }); + it("should escape close bottom panel one by one", async function () { panel1.show(); expect(panel1.isVisible()).toBeTrue();