From 5be7b6e14560704d5b75ce936f393803c7cae96f Mon Sep 17 00:00:00 2001 From: Pavel Nikolaev Date: Wed, 22 Feb 2023 13:13:59 +0300 Subject: [PATCH 1/3] Fixes VSCode modal inform message focus Fixes VSCode modal information message focus. Now focus will be on the first button, not on a background as it was before. Issue #12203 Signed-off-by: Pavel Nikolaev --- .../src/main/browser/dialogs/modal-notification.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/plugin-ext/src/main/browser/dialogs/modal-notification.ts b/packages/plugin-ext/src/main/browser/dialogs/modal-notification.ts index abe3ee6002d35..ed430a2956a77 100644 --- a/packages/plugin-ext/src/main/browser/dialogs/modal-notification.ts +++ b/packages/plugin-ext/src/main/browser/dialogs/modal-notification.ts @@ -12,6 +12,9 @@ // https://www.gnu.org/software/classpath/license.html. // // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +// +// Contributors: +// Pavel Nikolaev (1C-Soft LLC) - Issue #12203 // ***************************************************************************** import { injectable } from '@theia/core/shared/inversify'; import { Message } from '@theia/core/shared/@phosphor/messaging'; @@ -77,8 +80,13 @@ export class ModalNotification extends AbstractDialog { detailElement.textContent = options.detail; } - actions.forEach((action: MainMessageItem) => { - const button = this.createButton(action.title); + actions.forEach((action: MainMessageItem, index: number) => { + let button; + if (index === 0) { + button = this.appendAcceptButton(action.title); + } else { + button = this.createButton(action.title); + } button.classList.add('main'); this.controlPanel.appendChild(button); this.addKeyListener(button, From fdb14441b4a0d43f5fa42256d290a21ac8aed635 Mon Sep 17 00:00:00 2001 From: Zebsterpasha <77332790+Zebsterpasha@users.noreply.github.com> Date: Wed, 22 Feb 2023 16:54:28 +0300 Subject: [PATCH 2/3] Replaced condition IF with ternary operator Co-authored-by: Mark Sujew --- .../src/main/browser/dialogs/modal-notification.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/plugin-ext/src/main/browser/dialogs/modal-notification.ts b/packages/plugin-ext/src/main/browser/dialogs/modal-notification.ts index ed430a2956a77..d3c414ce42a2d 100644 --- a/packages/plugin-ext/src/main/browser/dialogs/modal-notification.ts +++ b/packages/plugin-ext/src/main/browser/dialogs/modal-notification.ts @@ -81,12 +81,9 @@ export class ModalNotification extends AbstractDialog { } actions.forEach((action: MainMessageItem, index: number) => { - let button; - if (index === 0) { - button = this.appendAcceptButton(action.title); - } else { - button = this.createButton(action.title); - } + const button = index === 0 + ? this.appendAcceptButton(action.title) + : this.createButton(action.title); button.classList.add('main'); this.controlPanel.appendChild(button); this.addKeyListener(button, From bb0c2240d4908d126ebf542542e79a110c707d46 Mon Sep 17 00:00:00 2001 From: Zebsterpasha <77332790+Zebsterpasha@users.noreply.github.com> Date: Wed, 22 Feb 2023 16:58:05 +0300 Subject: [PATCH 3/3] Delete contribution comments --- .../plugin-ext/src/main/browser/dialogs/modal-notification.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/plugin-ext/src/main/browser/dialogs/modal-notification.ts b/packages/plugin-ext/src/main/browser/dialogs/modal-notification.ts index d3c414ce42a2d..0d42eb1600850 100644 --- a/packages/plugin-ext/src/main/browser/dialogs/modal-notification.ts +++ b/packages/plugin-ext/src/main/browser/dialogs/modal-notification.ts @@ -12,9 +12,6 @@ // https://www.gnu.org/software/classpath/license.html. // // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 -// -// Contributors: -// Pavel Nikolaev (1C-Soft LLC) - Issue #12203 // ***************************************************************************** import { injectable } from '@theia/core/shared/inversify'; import { Message } from '@theia/core/shared/@phosphor/messaging';