web: wrap hidden inputs in form to prevent warning

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-03-21 17:55:09 +01:00
parent 25c82d80f5
commit 556a0d5d84
2 changed files with 8 additions and 8 deletions

View File

@ -5,7 +5,7 @@ html {
--pf-c-nav__link--PaddingLeft: 0.5rem; --pf-c-nav__link--PaddingLeft: 0.5rem;
} }
html > input { html > form > input {
position: absolute; position: absolute;
top: -2000px; top: -2000px;
left: -2000px; left: -2000px;
@ -21,6 +21,7 @@ html > input {
/* Ensure card is displayed on small screens */ /* Ensure card is displayed on small screens */
.pf-c-login__main { .pf-c-login__main {
display: block; display: block;
position: relative;
} }
.ak-login-container { .ak-login-container {
height: calc(100vh - var(--pf-global--spacer--lg) - var(--pf-global--spacer--lg)); height: calc(100vh - var(--pf-global--spacer--lg) - var(--pf-global--spacer--lg));
@ -32,11 +33,8 @@ html > input {
.pf-c-login__header { .pf-c-login__header {
flex-grow: 1; flex-grow: 1;
} }
.pf-c-login__main {
flex-shrink: 1;
}
.pf-c-login__footer { .pf-c-login__footer {
flex-grow: 1; flex-grow: 2;
} }
.pf-c-login__footer ul.pf-c-list.pf-m-inline { .pf-c-login__footer ul.pf-c-list.pf-m-inline {
justify-content: center; justify-content: center;

View File

@ -61,6 +61,8 @@ export class IdentificationStage extends BaseStage {
} }
firstUpdated(): void { firstUpdated(): void {
const wrapperForm = document.createElement("form");
document.documentElement.appendChild(wrapperForm);
// This is a workaround for the fact that we're in a shadow dom // This is a workaround for the fact that we're in a shadow dom
// adapted from https://github.com/home-assistant/frontend/issues/3133 // adapted from https://github.com/home-assistant/frontend/issues/3133
const username = document.createElement("input"); const username = document.createElement("input");
@ -76,7 +78,7 @@ export class IdentificationStage extends BaseStage {
input.focus(); input.focus();
}); });
}; };
document.documentElement.appendChild(username); wrapperForm.appendChild(username);
const password = document.createElement("input"); const password = document.createElement("input");
password.setAttribute("type", "password"); password.setAttribute("type", "password");
password.setAttribute("name", "password"); password.setAttribute("name", "password");
@ -98,7 +100,7 @@ export class IdentificationStage extends BaseStage {
input.focus(); input.focus();
}); });
}; };
document.documentElement.appendChild(password); wrapperForm.appendChild(password);
const totp = document.createElement("input"); const totp = document.createElement("input");
totp.setAttribute("type", "text"); totp.setAttribute("type", "text");
totp.setAttribute("name", "code"); totp.setAttribute("name", "code");
@ -120,7 +122,7 @@ export class IdentificationStage extends BaseStage {
input.focus(); input.focus();
}); });
}; };
document.documentElement.appendChild(totp); wrapperForm.appendChild(totp);
} }
renderSource(source: UILoginButton): TemplateResult { renderSource(source: UILoginButton): TemplateResult {