Automatically focus the execute button in the DacFx wizard summary screens (#6984)

* Focus piping for extension buttons

* Focus the done button when entering the summary page for DacFx wizard

* Adding internal value resets for extension-side button model.

* Correcting remark string
This commit is contained in:
Benjin Dubishar
2019-09-09 14:57:28 -07:00
committed by GitHub
parent 3e9b694e6f
commit 66cdbbb335
7 changed files with 46 additions and 2 deletions

View File

@@ -119,6 +119,11 @@ export class WizardModal extends Modal {
buttonElement.label = dialogButton.label;
buttonElement.enabled = requirePageValid ? dialogButton.enabled && this._wizard.pages[this._wizard.currentPage].valid : dialogButton.enabled;
dialogButton.hidden ? buttonElement.element.parentElement.classList.add('dialogModal-hidden') : buttonElement.element.parentElement.classList.remove('dialogModal-hidden');
if (dialogButton.focused) {
buttonElement.focus();
}
this.setButtonsForPage(this._wizard.currentPage);
}

View File

@@ -83,6 +83,7 @@ export class DialogButton implements azdata.window.Button {
private _label: string;
private _enabled: boolean;
private _hidden: boolean;
private _focused: boolean;
private _onClick: Emitter<void> = new Emitter<void>();
public readonly onClick: Event<void> = this._onClick.event;
private _onUpdate: Emitter<void> = new Emitter<void>();
@@ -121,6 +122,15 @@ export class DialogButton implements azdata.window.Button {
this._onUpdate.fire();
}
public get focused(): boolean {
return this._focused;
}
public set focused(focused: boolean) {
this._focused = focused;
this._onUpdate.fire();
}
/**
* Register an event that notifies the button that it has been clicked
*/
@@ -255,4 +265,4 @@ export class Wizard {
this._message = value;
this._onMessageChange.fire(this._message);
}
}
}