Fix enter button behavior for wizards and dialogs (#1868)

This commit is contained in:
Matt Irvine
2018-07-06 17:35:28 -07:00
committed by GitHub
parent 6b618fb121
commit bdc391d376
2 changed files with 9 additions and 3 deletions

View File

@@ -124,7 +124,7 @@ export class DialogModal extends Modal {
}
public async done(): Promise<void> {
if (this._dialog.okButton.enabled) {
if (this._doneButton.enabled) {
if (await this._dialog.validateClose()) {
this._onDone.fire();
this.dispose();

View File

@@ -207,7 +207,7 @@ export class WizardModal extends Modal {
}
public async done(validate: boolean = true): Promise<void> {
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 {