Skip to content

Commit 91d8106

Browse files
authored
V14: Login page throws validation errors (#16222)
* remove unused login-input.element.ts * fix: use regular html inputs to prevent validation errors that arose when we removed the shadow dom
1 parent 70cc0a5 commit 91d8106

File tree

4 files changed

+34
-97
lines changed

4 files changed

+34
-97
lines changed
Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,44 @@
1-
#umb-login-form umb-login-input {
1+
#umb-login-form input {
22
width: 100%;
33
height: var(--input-height);
44
box-sizing: border-box;
55
display: block;
66
border: 1px solid var(--uui-color-border);
77
border-radius: var(--uui-border-radius);
8-
outline: none;
98
background-color: var(--uui-color-surface);
10-
}
11-
12-
#umb-login-form umb-login-input input {
13-
width: 100%;
14-
height: 100%;
15-
display: block;
16-
box-sizing: border-box;
17-
border: none;
18-
outline: none;
19-
background: none;
209
padding: var(--uui-size-1, 3px) var(--uui-size-space-4, 9px);
21-
font-size: inherit;
2210
}
2311

2412
#umb-login-form uui-form-layout-item {
2513
margin-top: var(--uui-size-space-4);
2614
margin-bottom: var(--uui-size-space-4);
2715
}
2816

29-
#umb-login-form umb-login-input:focus-within {
17+
#umb-login-form input:focus-within {
3018
border-color: var(--uui-input-border-color-focus, var(--uui-color-border-emphasis, #a1a1a1));
3119
outline: calc(2px * var(--uui-show-focus-outline, 1)) solid var(--uui-color-focus);
3220
}
3321

34-
#umb-login-form umb-login-input:hover:not(:focus-within) {
22+
#umb-login-form input:hover:not(:focus-within) {
3523
border-color: var(--uui-input-border-color-hover, var(--uui-color-border-standalone, #c2c2c2));
3624
}
25+
26+
#umb-login-form input::-ms-reveal {
27+
display: none;
28+
}
29+
30+
#umb-login-form input span {
31+
position: absolute;
32+
right: 1px;
33+
top: 50%;
34+
transform: translateY(-50%);
35+
z-index: 100;
36+
}
37+
38+
#umb-login-form input span svg {
39+
background-color: white;
40+
display: block;
41+
padding: .2em;
42+
width: 1.3em;
43+
height: 1.3em;
44+
}

src/Umbraco.Web.UI.Login/src/auth.element.ts

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { html, customElement, property, ifDefined } from '@umbraco-cms/backoffice/external/lit';
22
import { UmbLitElement } from "@umbraco-cms/backoffice/lit-element";
3-
import { type InputType, type UUIFormLayoutItemElement, type UUILabelElement } from "@umbraco-cms/backoffice/external/uui";
3+
import type { InputType, UUIFormLayoutItemElement } from "@umbraco-cms/backoffice/external/uui";
44
import { umbExtensionsRegistry } from "@umbraco-cms/backoffice/extension-registry";
55

66
import { UMB_AUTH_CONTEXT, UmbAuthContext } from "./contexts";
7-
import type { UmbLoginInputElement } from "./components";
87
import { UmbSlimBackofficeController } from "./controllers";
98

109
// We import the authStyles here so that we can inline it in the shadow DOM that is created outside of the UmbAuthElement.
@@ -18,36 +17,33 @@ const createInput = (opts: {
1817
type: InputType;
1918
name: string;
2019
autocomplete: AutoFill;
21-
requiredMessage: string;
2220
label: string;
2321
inputmode: string;
2422
}) => {
25-
const input = document.createElement('umb-login-input');
23+
const input = document.createElement('input');
2624
input.type = opts.type;
2725
input.name = opts.name;
2826
input.autocomplete = opts.autocomplete;
2927
input.id = opts.id;
3028
input.required = true;
31-
input.requiredMessage = opts.requiredMessage;
32-
input.label = opts.label;
33-
input.spellcheck = false;
3429
input.inputMode = opts.inputmode;
30+
input.ariaLabel = opts.label;
3531

3632
return input;
3733
};
3834

3935
const createLabel = (opts: { forId: string; localizeAlias: string; localizeFallback: string; }) => {
40-
const label = document.createElement('uui-label');
36+
const label = document.createElement('label');
4137
const umbLocalize = document.createElement('umb-localize');
4238
umbLocalize.key = opts.localizeAlias;
4339
umbLocalize.innerHTML = opts.localizeFallback;
44-
label.for = opts.forId;
40+
label.htmlFor = opts.forId;
4541
label.appendChild(umbLocalize);
4642

4743
return label;
4844
};
4945

50-
const createFormLayoutItem = (label: UUILabelElement, input: UmbLoginInputElement) => {
46+
const createFormLayoutItem = (label: HTMLLabelElement, input: HTMLInputElement) => {
5147
const formLayoutItem = document.createElement('uui-form-layout-item') as UUIFormLayoutItemElement;
5248
formLayoutItem.appendChild(label);
5349
formLayoutItem.appendChild(input);
@@ -61,7 +57,7 @@ const createForm = (elements: HTMLElement[]) => {
6157
const form = document.createElement('form');
6258
form.id = 'umb-login-form';
6359
form.name = 'login-form';
64-
form.noValidate = true;
60+
form.spellcheck = false;
6561

6662
elements.push(styles);
6763
elements.forEach((element) => form.appendChild(element));
@@ -113,10 +109,10 @@ export default class UmbAuthElement extends UmbLitElement {
113109
_form?: HTMLFormElement;
114110
_usernameLayoutItem?: UUIFormLayoutItemElement;
115111
_passwordLayoutItem?: UUIFormLayoutItemElement;
116-
_usernameInput?: UmbLoginInputElement;
117-
_passwordInput?: UmbLoginInputElement;
118-
_usernameLabel?: UUILabelElement;
119-
_passwordLabel?: UUILabelElement;
112+
_usernameInput?: HTMLInputElement;
113+
_passwordInput?: HTMLInputElement;
114+
_usernameLabel?: HTMLLabelElement;
115+
_passwordLabel?: HTMLLabelElement;
120116

121117
#authContext = new UmbAuthContext(this, UMB_AUTH_CONTEXT);
122118

@@ -174,7 +170,6 @@ export default class UmbAuthElement extends UmbLitElement {
174170
type: 'text',
175171
name: 'username',
176172
autocomplete: 'username',
177-
requiredMessage,
178173
label: labelUsername,
179174
inputmode: this.usernameIsEmail ? 'email' : '',
180175
});
@@ -183,7 +178,6 @@ export default class UmbAuthElement extends UmbLitElement {
183178
type: 'password',
184179
name: 'password',
185180
autocomplete: 'current-password',
186-
requiredMessage,
187181
label: labelPassword,
188182
inputmode: '',
189183
});
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
export * from './layouts/index.js';
22
export * from './pages/index.js';
33
export * from './back-to-login-button.element.js';
4-
export * from './login-input.element.js';

src/Umbraco.Web.UI.Login/src/components/login-input.element.ts

Lines changed: 0 additions & 64 deletions
This file was deleted.

0 commit comments

Comments
 (0)