web: shared modal focus controller (M1/M2) — work in progress
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user