web: shared modal focus controller (M1/M2) — work in progress

This commit is contained in:
2026-10-19 20:46:15 +01:00
parent a7991077d2
commit b1e9400d6e
11 changed files with 1562 additions and 121 deletions
+6 -2
View File
@@ -25,7 +25,7 @@ import {
} from "../templates.js";
export function createTemplatesView(rt) {
const { state, repo } = rt;
const { state, repo, modal } = rt;
const renderContent = (...args) => rt.renderContent(...args);
const focusDetailHeading = (...args) => rt.focusDetailHeading(...args);
const pushRoute = (...args) => rt.pushRoute(...args);
@@ -133,7 +133,6 @@ function openTemplateCreateDialog() {
state.templateCreateError = "";
state.templateCreateCreated = null;
renderContent();
document.querySelector(".template-create-name")?.focus();
}
/** Dismiss the create dialog (never while a validate+submit is in flight). */
@@ -229,6 +228,11 @@ function renderTemplateCreateDialog(entry) {
);
panel.append(actions);
overlay.append(panel);
modal.stage("template-create", overlay, {
onClose: () => closeTemplateCreateDialog(),
triggerSelector: ".template-create-open",
fallbackSelectors: ["#detailTitle", "#pane-main"],
});
return overlay;
}