diff --git a/packages/playground/src/components/weblet_layout.vue b/packages/playground/src/components/weblet_layout.vue index d4ca692fe8..7d90dd7e56 100644 --- a/packages/playground/src/components/weblet_layout.vue +++ b/packages/playground/src/components/weblet_layout.vue @@ -202,7 +202,7 @@ function validateBeforeDeploy(fn: () => void) { const inputs = form.inputs as unknown as InputValidatorService[]; for (const input of inputs) { - const status = input.status; + const status = typeof input.status === "string" ? input.status : (input.status as any)?.value; if (status === ValidatorStatus.Invalid) { errorInput = [i, input.$el]; break out; @@ -217,7 +217,14 @@ function validateBeforeDeploy(fn: () => void) { } if (errorInput) { - const [tab, input] = errorInput; + const [tab, __input] = errorInput; + + const input = + __input && typeof __input === "object" && "value" in __input && __input.value instanceof HTMLElement + ? __input.value + : __input instanceof HTMLElement + ? __input + : null; if (!input || !__setTab) { return; @@ -227,7 +234,11 @@ function validateBeforeDeploy(fn: () => void) { // Timeout so the ui gets render before scroll setTimeout(() => { - const _input = input.querySelector("textarea") || input.querySelector("input") || input; + const _input = input.querySelector("textarea") || input.querySelector("input") || null; + if (!(_input instanceof HTMLElement)) { + return; + } + document.addEventListener("scrollend", () => _input.focus(), { once: true }); _input.scrollIntoView({ behavior: "smooth", block: "center" }); }, 250); diff --git a/packages/playground/src/weblets/freeflow.vue b/packages/playground/src/weblets/freeflow.vue index 09808f48fc..4b51bccaec 100644 --- a/packages/playground/src/weblets/freeflow.vue +++ b/packages/playground/src/weblets/freeflow.vue @@ -13,7 +13,7 @@ > - + - +