fix(erp-dialog): 모달 팝업 안에서 확인 창이 뒤에 깔려 안 보이던 문제

입출고 옵션(상품 정보) ✕ 지우기 등 모달 <dialog>(showModal) 안에서 erpConfirm 을 부르면
body 에 붙인 확인 창이 브라우저 맨 위 층 뒤에 깔려 보이지도 눌리지도 않았다.
모달이 열려 있을 때만 확인 창을 모달 <dialog> 껍데기로 감싸 그 위에 띄운다(Esc = 취소). 평소엔 예전 그대로.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-17 01:08:49 +09:00
parent b5bdf99069
commit 86ea9a11d4
4 changed files with 39 additions and 5 deletions
@@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>{{ page_title or '주간 회의록' }}</title>
<link rel="stylesheet" href="/static/erp.css?v=20260615b" />
<link rel="stylesheet" href="/static/erp-dialog.css?v=20260930a" />
<link rel="stylesheet" href="/static/erp-dialog.css?v=20261017a" />
{% block head_extra %}{% endblock %}
<link rel="stylesheet" href="/static/project-goal-nav.css?v=20261004e" />
<script>
@@ -17,6 +17,6 @@
</head>
<body class="erp-body">
<main class="erp-page">{% block content %}{% endblock %}</main>
<script src="/static/erp-dialog.js?v=20260930a"></script>
<script src="/static/erp-dialog.js?v=20261017a"></script>
</body>
</html>
+16
View File
@@ -4,6 +4,22 @@
없다. 화면 정중앙에 같은 모양으로 띄우기 위해 직접 그린다(erp-dialog.js).
════════════════════════════════════════════════════ */
/* 모달 <dialog> 위에 띄울 때 감싸는 껍데기(erp-dialog.js) — 모양은 안쪽 .erp-dialog-backdrop 그대로, 껍데기는 보이지 않게 */
.erp-dialog-host {
position: fixed;
inset: 0;
width: 100%;
height: 100%;
max-width: none;
max-height: none;
margin: 0;
padding: 0;
border: 0;
background: transparent;
overflow: visible;
}
.erp-dialog-host::backdrop { background: transparent; }
.erp-dialog-backdrop {
position: fixed;
inset: 0;
+19 -1
View File
@@ -116,11 +116,23 @@
var previous = document.activeElement;
var closed = false;
// 모달 <dialog>(showModal — 브라우저 맨 위 층)가 열려 있으면 body 에 붙인 창은 그 뒤에 깔려 안 보이고 눌리지도 않는다
// (예: 입출고 옵션 팝업 안 [지우기] 확인). 그때만 이 창도 모달 <dialog> 로 감싸 그 위에 띄운다. 평소엔 예전 그대로.
var host = null;
try {
if (document.querySelector("dialog[open]:modal")) {
host = document.createElement("dialog");
host.className = "erp-dialog-host";
host.addEventListener("cancel", function (e) { e.preventDefault(); close(false); }); // Esc = 취소
}
} catch (_) { host = null; } // :modal 을 모르는 아주 옛 브라우저
function close(result) {
if (closed) return;
closed = true;
document.removeEventListener("keydown", onKey, true);
el.backdrop.remove();
if (host) { if (host.open) host.close(); host.remove(); }
if (previous && typeof previous.focus === "function") previous.focus();
// 입력창이면 확인 = 입력한 글자, 취소 = null
if (el.input) resolve(result ? el.input.value : null);
@@ -154,7 +166,13 @@
});
document.addEventListener("keydown", onKey, true);
document.body.appendChild(el.backdrop);
if (host) {
host.appendChild(el.backdrop);
document.body.appendChild(host);
host.showModal();
} else {
document.body.appendChild(el.backdrop);
}
if (el.input) { el.input.focus(); el.input.select(); }
else el.ok.focus();
});
+2 -2
View File
@@ -7,7 +7,7 @@
<link rel="stylesheet" href="/static/erp.css?v=20260615b" />
<link rel="stylesheet" href="/static/erp-shell.css?v=20260615b" />
<link rel="stylesheet" href="/static/erp-attach-viewer.css" />
<link rel="stylesheet" href="/static/erp-dialog.css?v=20260930a" />
<link rel="stylesheet" href="/static/erp-dialog.css?v=20261017a" />
<link rel="stylesheet" href="/static/erp-notice.css?v=20261015a" />
<link rel="stylesheet" href="/static/erp-overdue.css?v=20261013a" />
{% block head_extra %}{% endblock %}
@@ -189,7 +189,7 @@
{# 공용 확인/경고 창. defer 를 쓰지 않는다 — 아래 {% block scripts %} 의
인라인 스크립트가 곧바로 erpConfirm/erpAlert 을 쓸 수 있어야 한다. #}
<script src="/static/erp-dialog.js?v=20260930a"></script>
<script src="/static/erp-dialog.js?v=20261017a"></script>
<script src="/static/erp-attach-viewer.js" defer></script>
{# 긴급 공지 — 로그인한 모든 화면 가운데(받는 사람이 [확인] 전까지). app/modules/notice #}
{% if user %}<script src="/static/erp-notice.js?v=20261015a" defer></script>{% endif %}