Preserve Dock navigation and align account screens

This commit is contained in:
SantaSpeen committed 2026-11-30 23:33:20 +03:00
1 parent 17011ebd4d
commit ef98c2835b
28 files changed
+132 -14

No files matched your search

+4
View File
@@ -2,6 +2,10 @@
Уточнения Dock: переключатель 44×24px с бегунком 18px и равными отступами; перемещение и смена цвета — 160ms. Выпадающие и контекстные меню имеют скругление control и появление 180ms; reduced motion отключает анимацию. График показывает ближайшее время и p95 при наведении/касании; стрелки, Home/End и Escape доступны с клавиатуры. Числовая таблица сохранена. Тост использует manual popover в верхнем слое браузера и виден поверх модального затемнения.
Меню аккаунта содержит только Аккаунт, доступную по роли Панель управления, Сменить аккаунт и Выйти из SSO. Настройки и приложения доступны через навигацию личного кабинета.
Навигация Dock: выбранный пункт сохраняет цвет при наведении. Переход по меню сохраняет раскрытую панель и режим открытия (hover или закрепление); Escape, подложка и уход мыши из hover-меню закрывают её.
Исполняемые образцы: экран Components; таблица и фильтры — Users; вкладки — Settings; вход — Authentication. Основная стилизация в `system.css`.
| Компонент | Состояния и взаимодействия |
+1 -1
View File
@@ -118,7 +118,7 @@ export function createAccountUI({
return `${heading(title.profile, t("Личные данные и ваш профиль в экосистеме Anidev.", "Your profile across the Anidev ecosystem."))}<div class="page-body identity-body"><div class="identity-profile-summary">${avatar(a, "large")}<div><h2>${e(names(a))}</h2><p>@${e(a.username)}</p><div class="identity-roles">${a.roles.map((r) => `<span>${e(r)}</span>`).join("")}</div></div></div><div class="identity-split"><section><h2>${t("Личные данные", "Personal information")}</h2><p class="muted">${t("Имя и username можно изменить. Идентификатор аккаунта остаётся прежним.", "Your name and username may change. Your account ID stays the same.")}</p></section><form id="identity-profile"><div class="identity-fields"><label class="field">${t("Имя", "First name")}<input name="firstName" required maxlength="50" autocomplete="given-name" value="${e(a.firstName)}"></label><label class="field">${t("Фамилия", "Last name")}<input name="lastName" required maxlength="50" autocomplete="family-name" value="${e(a.lastName)}"></label></div><label class="field">Username<input name="username" required pattern="[a-zA-Z0-9._-]+" maxlength="40" autocomplete="username" value="${e(a.username)}"></label><div class="identity-readonly"><span>Email</span><strong>${a.email ? e(a.email) : t("Не добавлен", "Not added")}</strong>${a.emailVerified ? `<span class="status">${t("Подтверждён", "Verified")}</span>` : action("add-email", "Добавить и подтвердить", "Add and verify")}</div><small>${t("Для изменения подтверждённой почты обратитесь к администратору.", "Contact your administrator to change a verified email address.")}</small><div class="identity-avatar-editor"><div id="avatar-preview">${avatar(a)}</div><div><label class="file-button">${t("Выбрать фотографию", "Choose photo")}<input id="identity-avatar-file" type="file" accept="image/png,image/jpeg,image/webp"></label><small>PNG, JPEG, WebP · ${t("до 2 МБ", "up to 2 MB")}</small>${action("clear-avatar", "Убрать фото", "Remove photo")}</div></div><p id="profile-error" class="error-text" role="alert"></p><div class="form-footer"><button type="reset">${t("Отмена", "Cancel")}</button><button class="primary" type="submit">${t("Сохранить профиль", "Save profile")}</button></div></form></div><div class="identity-footnote"><span>Account ID</span><code>${e(a.sub)}</code></div>${demo}</div>`;
}
function security(a) {
return `${heading(title.security, t("Способы входа и подтверждение важных действий.", "Sign-in methods and verification for important changes."))}<div class="page-body identity-body"><section class="identity-section"><h2>${t("Способы входа", "Sign-in methods")}</h2><div class="identity-setting-row"><div><h3>${t("Пароль", "Password")}</h3><p>${t("Последнее изменение: ", "Last changed: ")}${a.passwordChanged ? new Intl.DateTimeFormat(t("ru-RU", "en-US"), { dateStyle: "long" }).format(new Date(a.passwordChanged + "T12:00:00Z")) : t("нет данных", "no data")}</p></div>${action("password-link", "Сменить", "Change")}</div><div class="identity-setting-row"><div><h3>TOTP</h3><p class="status ${a.totp ? "" : "warn"}">${a.totp ? t("Подключён", "Enabled") : t("Не подключён", "Not enabled")}</p><small>${t("Сброс подтверждается ссылкой из письма.", "Reset is verified using an email link.")}</small></div>${action(a.totp ? "totp-link" : "enroll-factor", a.totp ? "Сменить" : "Подключить", a.totp ? "Change" : "Set up")}</div></section><section class="identity-section"><div class="section-title"><div><h2>Passkey</h2><p class="muted">${t("Встроенный способ входа: Windows Hello или Touch ID.", "Platform sign-in with Windows Hello or Touch ID.")}</p></div>${action("add-passkey", "Добавить", "Add")}</div>${a.passkeys.length ? a.passkeys.map((k) => `<div class="identity-setting-row"><div><h3>${e(k.name)}</h3><p>${t("Добавлен", "Added")} ${k.created}</p></div><button class="danger" data-identity="remove-passkey" data-key="${e(k.id)}">${t("Удалить", "Remove")}</button></div>`).join("") : `<div class="empty-state"><h3>${t("Passkey ещё не добавлен", "No passkey added yet")}</h3><p>${t("Добавьте ключ, чтобы входить с помощью устройства.", "Add a key to sign in with your device.")}</p></div>`}</section><section class="identity-section identity-security-note"><h2>${t("Как работают проверки", "How verification works")}</h2><p>${t("Приложение запрашивает только недостающий фактор. Возможность заменить TOTP свежим Passkey задаёт администратор приложения. Для администрирования SSO требуется отдельный TOTP.", "Applications request only the missing factor. An application administrator decides whether a fresh passkey can replace TOTP. SSO administration requires a separate TOTP verification.")}</p></section>${demo}</div>`;
return `${heading(title.security, t("Способы входа и подтверждение важных действий.", "Sign-in methods and verification for important changes."))}<div class="page-body identity-body identity-security"><section class="identity-section"><h2>${t("Способы входа", "Sign-in methods")}</h2><div class="identity-setting-row"><div><h3>${t("Пароль", "Password")}</h3><p>${t("Последнее изменение: ", "Last changed: ")}${a.passwordChanged ? new Intl.DateTimeFormat(t("ru-RU", "en-US"), { dateStyle: "long" }).format(new Date(a.passwordChanged + "T12:00:00Z")) : t("нет данных", "no data")}</p></div>${action("password-link", "Сменить", "Change")}</div><div class="identity-setting-row"><div><h3>TOTP</h3><p class="status ${a.totp ? "" : "warn"}">${a.totp ? t("Подключён", "Enabled") : t("Не подключён", "Not enabled")}</p><small>${t("Сброс подтверждается ссылкой из письма.", "Reset is verified using an email link.")}</small></div>${action(a.totp ? "totp-link" : "enroll-factor", a.totp ? "Сменить" : "Подключить", a.totp ? "Change" : "Set up")}</div></section><section class="identity-section"><div class="section-title"><div><h2>Passkey</h2><p class="muted">${t("Встроенный способ входа: Windows Hello или Touch ID.", "Platform sign-in with Windows Hello or Touch ID.")}</p></div>${action("add-passkey", "Добавить", "Add")}</div>${a.passkeys.length ? a.passkeys.map((k) => `<div class="identity-setting-row"><div><h3>${e(k.name)}</h3><p>${t("Добавлен", "Added")} ${k.created}</p></div><button class="danger" data-identity="remove-passkey" data-key="${e(k.id)}">${t("Удалить", "Remove")}</button></div>`).join("") : `<div class="empty-state"><h3>${t("Passkey ещё не добавлен", "No passkey added yet")}</h3><p>${t("Добавьте ключ, чтобы входить с помощью устройства.", "Add a key to sign in with your device.")}</p></div>`}</section><section class="identity-section identity-security-note"><h2>${t("Как работают проверки", "How verification works")}</h2><p>${t("Приложение запрашивает только недостающий фактор. Возможность заменить TOTP свежим Passkey задаёт администратор приложения. Для администрирования SSO требуется отдельный TOTP.", "Applications request only the missing factor. An application administrator decides whether a fresh passkey can replace TOTP. SSO administration requires a separate TOTP verification.")}</p></section>${demo}</div>`;
}
function sessions() {
const rows = snap().sessions;
+62 -4
View File
@@ -1033,9 +1033,17 @@ body[data-concept="dock"] .services {
gap: 16px;
}
body[data-concept="dock"] .service {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
display: grid;
grid-template-columns: minmax(0, 1fr) 6ch max-content;
gap: 10px;
}
body[data-concept="dock"] .service > small,
body[data-concept="dock"] .service > .status {
text-align: right;
}
body[data-concept="dock"] .service > span:first-child {
min-width: 0;
overflow-wrap: anywhere;
}
body[data-concept="dock"] .activity {
background: var(--color-surface);
@@ -1929,6 +1937,54 @@ body[data-concept="dock"] .header-actions > .avatar {
color: var(--color-muted);
line-height: 1.7;
}
.identity-security .identity-section {
padding: 0;
margin-bottom: 24px;
border-bottom: 0;
}
.identity-security .identity-section > h2,
.identity-security .identity-section > .section-title {
margin: 0;
padding: 12px 16px;
}
.identity-security .identity-setting-row {
padding: 16px;
position: relative;
border-top: 0;
border-radius: var(--radius-control);
}
.identity-security .identity-setting-row::before {
content: "";
position: absolute;
inset: 0 16px auto;
border-top: 1px solid var(--color-border);
pointer-events: none;
}
.identity-security .identity-setting-row > div {
min-width: 0;
}
.identity-security .identity-setting-row > button {
flex-shrink: 0;
}
.identity-security .identity-setting-row small {
display: block;
margin-top: 6px;
color: var(--color-muted);
}
.identity-security .identity-security-note {
border-top: 1px solid var(--color-border);
padding-top: 12px;
}
.identity-security-note > p {
margin: 0 16px;
}
@media (max-width: 480px) {
.identity-security .identity-setting-row {
flex-direction: column;
align-items: flex-start;
gap: 12px;
}
}
.identity-list-heading {
display: flex;
justify-content: space-between;
@@ -2436,7 +2492,9 @@ body[data-concept="dock"] .nav-links button[aria-current="page"] {
background: var(--color-row-active);
color: var(--color-accent);
}
body[data-concept="dock"] .nav-links button:is(:hover, :focus-visible) {
body[data-concept="dock"]
.nav-links
button:not([aria-current="page"]):is(:hover, :focus-visible) {
background: var(--color-row-hover);
color: var(--color-text);
}
+16 -8
View File
@@ -252,9 +252,6 @@ function navigationPages() {
function dockAccount() {
return `<div class="dock-account-area"><div id="account-menu" class="account-menu" popover="auto" aria-label="${t("Меню аккаунта", "Account menu")}">
<button autofocus data-page="profile">${icon("users")}<span>${t("Аккаунт", "Account")}</span></button>
<button data-page="security">${icon("settings")}<span>${t("Настройки", "Settings")}</span></button>
<button data-page="applications">${icon("applications")}<span>${t("Приложения", "Applications")}</span></button>
<button data-action="shares">${icon("components")}<span>${t("Мои общие ресурсы", "My shares")}</span></button>
${currentIdentity()?.roles.some((r) => ["Master Admin", "SSO Admin"].includes(r)) ? `<button data-page="dashboard">${icon("dashboard")}<span>${t("Панель управления", "Control panel")}</span></button>` : ""}
<button class="account-separator" data-identity="switch">${icon("users")}<span>${t("Сменить аккаунт", "Switch account")}</span></button>
<button class="account-separator" data-identity="logout"><svg class="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M9 4H4v16h5M13 7l5 5-5 5M8 12h11"/></svg><span>${t("Выйти из SSO", "Sign out of SSO")}</span></button></div>
@@ -342,7 +339,11 @@ function savePreferences() {
} catch {}
}
let initialRender = true;
function render() {
function render({ preserveDock = false } = {}) {
const dockWasOpen =
preserveDock &&
document.body.classList.contains("dock-open") &&
page !== "auth";
const route = new URL(location.href);
route.searchParams.delete("concept");
route.searchParams.set("page", page);
@@ -358,9 +359,11 @@ function render() {
]({}, "", route);
}
initialRender = false;
dockHoverOpened = false;
clearTimeout(dockCloseTimer);
document.body.classList.remove("dock-open");
if (!dockWasOpen) {
dockHoverOpened = false;
document.body.classList.remove("dock-open");
}
document.title = `Anidev / ${concept.name} / ${pageNames[page]}`;
const content = accountPageIds.includes(page)
? accountUI.renderPage(page)
@@ -386,6 +389,7 @@ function render() {
bindForms();
accountUI.bind(page);
bindDockHover();
if (dockWasOpen) setDockOpen(true, false);
bindCharts();
if (page === "users" && $("#user-search")) bindUsers();
}
@@ -817,10 +821,14 @@ document.addEventListener("click", async (e) => {
if (await accountUI.handleClick(e)) return;
const pageButton = e.target.closest("[data-page]");
if (pageButton) {
const fromDock = Boolean(pageButton.closest(".navigation"));
if (fromDock && page === pageButton.dataset.page) return;
page = pageButton.dataset.page;
$("#dialog").close();
render();
$("#content")?.focus();
render({ preserveDock: fromDock });
if (fromDock && document.body.classList.contains("dock-open")) {
$(".nav-links [aria-current=page]")?.focus({ preventScroll: true });
} else $("#content")?.focus();
return;
}
const sorter = e.target.closest("[data-sort]");
+11
View File
@@ -75,3 +75,14 @@ Core 50/50, Dock 10/10, Identity 94/94, TOTP geometry 4/4, feedback/scroll 24/24
Core 50/50, standalone site 35/35 (включая четыре старые ссылки concept), Dock 10/10, Identity 94/94, TOTP 4/4, feedback/scroll 24/24. Всего 217, ошибок JavaScript нет. После удаления неиспользуемой ветки обнаружена и исправлена зависимость формы входа от общего логотипа; соответствующие suite повторены успешно.
Дополнительно 36 целевых проверок в Edge: геометрия переключателя в обоих состояниях, двух темах и desktop/mobile; скругление/анимация меню и reduced motion; значения и границы подсказки графика, клавиатура и семидневный диапазон; касание в мобильном контексте; тост в верхнем слое при открытом диалоге. Скриншоты меню, переключателя, графика и тоста проверены визуально. Это не полный аудит доступности.
## Dock / навигация и отступы, 30.11.2026
У выбранного пункта нет дополнительной hover-подсветки. Переход по пунктам не удаляет dock-open; сохраняются затемнение, inert основной области и способ открытия. Повторный клик выбранного раздела не пересоздаёт экран. Клавиатурный фокус остаётся в меню.
В безопасности строки получили одинаковые поля 16px, заголовки и кнопки выровнены; мобильные действия переносятся под текст. Сервисы используют общие grid-колонки с выровненными справа значениями задержки.
Standalone site 35/35 и Dock 10/10 повторены успешно. В site добавлены утверждения сохранения раскрытия/inert после перехода, повторного клика и стабильного цвета выбранного пункта. Дополнительная проверка: 12 сочетаний RU/EN, двух тем и трёх ширин (1440/768/390), отступы/переполнение безопасности, общая колонка задержек, переход из hover-Dock и Escape; ошибок JavaScript нет. Скриншоты безопасности desktop/mobile и сервисов проверены визуально.
Меню аккаунта сокращено до Аккаунта, Панели управления (по роли), Сменить аккаунт и Выйти из SSO. В обеих темах проверены отсутствие трёх удалённых пунктов и сохранение оставшихся действий.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

+11 -1
View File
@@ -147,6 +147,16 @@ try {
await p.locator(".dock-toggle").getAttribute("aria-expanded"),
"true",
);
await p.locator('.nav-links [data-page="users"]').click();
await p.waitForTimeout(300);
assert.equal(
await p.locator(".dock-toggle").getAttribute("aria-expanded"),
"true",
);
assert.equal(
await p.locator(".main-column").evaluate((el) => el.inert),
true,
);
await p.mouse.move(380, 400);
await p.waitForTimeout(450);
assert.equal(
@@ -174,7 +184,7 @@ try {
await touch.close();
passed++;
await p.emulateMedia({ reducedMotion: "reduce" });
await p.reload();
await p.goto(`${base}/?page=dashboard`);
assert.equal(
await p
.locator(".panel")
+27
View File
@@ -76,6 +76,33 @@ try {
});
await p.locator(".nav-links [data-page=users]").click();
await p.locator("#user-search").waitFor();
assert.equal(
await p.locator(".dock-brand").getAttribute("aria-expanded"),
"true",
);
assert.equal(
await p.locator(".main-column").evaluate((el) => el.inert),
true,
);
const selectedItem = p.locator('.nav-links [aria-current="page"]');
await p.mouse.move(width - 12, height - 12);
await p.waitForTimeout(200);
const selectedColor = await selectedItem.evaluate(
(el) => getComputedStyle(el).backgroundColor,
);
await selectedItem.hover();
await p.waitForTimeout(160);
assert.equal(
await selectedItem.evaluate(
(el) => getComputedStyle(el).backgroundColor,
),
selectedColor,
);
await selectedItem.click();
assert.equal(
await p.locator(".dock-brand").getAttribute("aria-expanded"),
"true",
);
assert.equal(new URL(p.url()).searchParams.get("page"), "users");
assert.equal(
await p