Late addition: I had an inspiration about how to reduce the way

reactivity broke focus by, basically, removing the reactivity and
managing the first-time-through lifecycle to prevent the update
from causing refocus.  It works well!  Now I just need to test it.
This commit is contained in:
Ken Sternberg 2023-08-11 20:47:55 -07:00
parent 356488809c
commit 2222f6722e
3 changed files with 13 additions and 4 deletions

View File

@ -17,14 +17,22 @@ export class ApplicationWizardPageBase extends CustomEmitterElement(AKElement) {
@query("form")
form!: HTMLFormElement;
rendered = false;
// @ts-expect-error
@consume({ context: applicationWizardContext, subscribe: true })
@state()
@consume({ context: applicationWizardContext })
public wizard!: WizardState;
shouldUpdate(changedProperties: Map<string, any>) {
if (!this.rendered) {
this.rendered = true;
return true;
}
return (changedProperties.size !== 0)
}
dispatchWizardUpdate(update: Partial<WizardState>) {
// TODO: Incorporate this into the message heading upward: "the current step is valid."
console.log(this.form.reportValidity());
this.dispatchCustomEvent("ak-application-wizard-update", {
...this.wizard,

View File

@ -30,7 +30,6 @@ export class ApplicationWizard extends CustomListenerElement(AKElement) {
* Providing a context at the root element
*/
@provide({ context: applicationWizardContext })
@property({ attribute: false })
wizardState: WizardState = {
step: 0,
providerType: "",

View File

@ -31,7 +31,9 @@ export class ApplicationWizardApplicationDetails extends BasePanel {
});
}
render(): TemplateResult {
console.log("HUH?");
return html` <form class="pf-c-form pf-m-horizontal" @input=${this.handleChange}>
<ak-text-input
name="name"