[web] Design review: last row's menu not clipped, Hostname focused after loading, popover closes on Esc and outside click, phone engine chip in the top bar, paused and needs-attention copy with Restore in the panel, change bar offers and countdown, focus after share and kept, fingerprint check when signing by hand, draft kept through sign-in

This commit is contained in:
2026-11-08 11:21:44 +01:00
parent b24ffdf9db
commit 503916492d
24 changed files with 364 additions and 119 deletions
+20 -3
View File
@@ -39,12 +39,29 @@
if (modal && typeof el.showModal === "function") el.showModal();
else if (typeof el.show === "function") el.show();
else el.setAttribute("open", "");
const first = el.querySelector<HTMLElement>(
"[data-autofocus], input:not([type=hidden]):not([readonly]):not([type=radio]), textarea, select",
);
const first =
el.querySelector<HTMLElement>("[data-autofocus]") ??
el.querySelector<HTMLElement>("input:not([type=hidden]):not([readonly]):not([type=radio]), textarea:not([readonly]), select");
(first ?? el.querySelector<HTMLElement>(".ia-dialog-title"))?.focus();
}
// A dialog opened with show() (the popover) gets no cancel event: Esc and a click outside
// close it here, like the modal ones.
const key = (e: KeyboardEvent) => {
if (!modal && e.key === "Escape" && escape) {
e.preventDefault();
onclose();
}
};
const down = (e: PointerEvent) => {
if (!modal && escape && el && e.target instanceof Node && !el.contains(e.target)) onclose();
};
document.addEventListener("keydown", key);
// On the next turn, so the click that opened the popover does not close it.
const t = setTimeout(() => document.addEventListener("pointerdown", down), 0);
return () => {
clearTimeout(t);
document.removeEventListener("keydown", key);
document.removeEventListener("pointerdown", down);
if (opener instanceof HTMLElement && document.contains(opener)) opener.focus();
};
});