From bdc391d37625e848a19b3e130bb4abef3d076015 Mon Sep 17 00:00:00 2001 From: Matt Irvine Date: Fri, 6 Jul 2018 17:35:28 -0700 Subject: [PATCH] Fix enter button behavior for wizards and dialogs (#1868) --- src/sql/platform/dialog/dialogModal.ts | 2 +- src/sql/platform/dialog/wizardModal.ts | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/sql/platform/dialog/dialogModal.ts b/src/sql/platform/dialog/dialogModal.ts index b869174c23..527d5a3773 100644 --- a/src/sql/platform/dialog/dialogModal.ts +++ b/src/sql/platform/dialog/dialogModal.ts @@ -124,7 +124,7 @@ export class DialogModal extends Modal { } public async done(): Promise { - if (this._dialog.okButton.enabled) { + if (this._doneButton.enabled) { if (await this._dialog.validateClose()) { this._onDone.fire(); this.dispose(); diff --git a/src/sql/platform/dialog/wizardModal.ts b/src/sql/platform/dialog/wizardModal.ts index fdc964e630..b71f11cb6e 100644 --- a/src/sql/platform/dialog/wizardModal.ts +++ b/src/sql/platform/dialog/wizardModal.ts @@ -207,7 +207,7 @@ export class WizardModal extends Modal { } public async done(validate: boolean = true): Promise { - if (this._wizard.doneButton.enabled) { + if (this._doneButton.enabled) { if (validate && !await this._wizard.validateNavigation(undefined)) { return; } @@ -242,7 +242,13 @@ export class WizardModal extends Modal { * Overridable to change behavior of enter key */ protected onAccept(e: StandardKeyboardEvent) { - this.done(); + if (this._wizard.currentPage === this._wizard.pages.length - 1) { + this.done(); + } else { + if (this._nextButton.enabled) { + this.showPage(this._wizard.currentPage + 1); + } + } } public dispose(): void {