fix(프로젝트): 옵션 시각 팝업 휠·마우스 오버·클릭 안 먹던 문제 — 모달 창 안에 붙임, 지우기·확인 동작·색

모달 dialog 가 열려 있으면 창 밖(body) 요소는 inert 라 popover 를 body 에 붙이면 마우스가 통과했다.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-11 14:50:55 +09:00
parent 0e6bb53c9c
commit 6e69abcfa3
13 changed files with 31 additions and 20 deletions
+15 -9
View File
@@ -65,7 +65,9 @@
// ── 시각 고르기 팝업(2026-11-11) — 날짜 팝업(.pj-datepop)과 같은 카드·꼬리·파란 선택.
// 시(00~23)·분(00~55, 5분 단위) 두 열, 브라우저 기본 시계처럼 돌아가지 않고 끝에서 멈춘다.
// 모달 창 위에 떠야 해서 popover(top layer)로 body 에 붙인다. 시 = 바꾸고 열어 둠, 분 = 바꾸고 닫음.
// 모달 창 위에 떠야 해서 popover(top layer) — 단 옵션 창(dialog) **안에** 붙인다: 모달이 열려 있으면 창 밖 요소는
// inert 라 body 에 붙이면 휠·마우스 오버·클릭이 모두 안 먹었다(2026-11-11). 시 = 바꾸고 열어 둠, 분 = 바꾸고 닫음.
// [확인] = 지금 값 저장 후 닫기, [지우기] = 시각 비우고 닫기(저장 버튼을 눌러야 서버에 반영).
let timePop = null, timePopOff = null;
function closeTimePop() {
if (!timePop) return;
@@ -96,7 +98,7 @@
'<div class="pj-dp-foot"><button type="button" class="pj-dp-link" data-tp="clear">지우기</button>' +
'<button type="button" class="pj-dp-link" data-tp="ok">확인</button></div>';
paintHead();
document.body.appendChild(pop); // 배율(.pj-ui-scale) 밖
dialog.appendChild(pop);
try { pop.showPopover(); } catch (_) {}
function commit() { if (h) setTimeBtn(btn, h + ":" + (m || "00")); }
pop.addEventListener("click", function (e) {
@@ -111,19 +113,23 @@
return;
}
const act = e.target.closest("[data-tp]");
if (act && act.dataset.tp === "clear") setTimeBtn(btn, "");
if (act) closeTimePop();
if (!act) return;
if (act.dataset.tp === "clear") { h = m = ""; setTimeBtn(btn, ""); }
else commit();
closeTimePop(); btn.focus();
});
// 자리 — 앵커 아래(자리 없으면 위), 꼬리가 앵커 가운데(날짜 팝업 place 와 같음)
// 자리 — 앵커 아래(자리 없으면 위), 꼬리가 앵커 가운데(날짜 팝업 place 와 같음).
// 화면 배율(.pj-ui-scale zoom) 안이면 left/top 값도 배율만큼 줄어 보이므로 나눠 준다(currentCSSZoom).
const z = pop.currentCSSZoom || 1;
const r = btn.getBoundingClientRect();
const vw = document.documentElement.clientWidth, vh = document.documentElement.clientHeight;
const w = pop.offsetWidth, ph = pop.offsetHeight, ax = r.left + r.width / 2;
const w = pop.offsetWidth * z, ph = pop.offsetHeight * z, ax = r.left + r.width / 2;
const left = Math.min(Math.max(8, ax - w / 2), vw - w - 8);
const below = r.bottom + 10 + ph <= vh - 8 || r.top - 10 - ph < 8;
pop.classList.toggle("is-above", !below);
pop.style.left = left + "px";
pop.style.top = (below ? r.bottom + 10 : r.top - 10 - ph) + "px";
pop.style.setProperty("--pj-dp-tail", Math.min(Math.max(ax - left, 16), w - 16) + "px");
pop.style.left = left / z + "px";
pop.style.top = (below ? r.bottom + 10 : r.top - 10 - ph) / z + "px";
pop.style.setProperty("--pj-dp-tail", Math.min(Math.max(ax - left, 16), w - 16) / z + "px");
// 고른 값이 보이게 — 열 안에서만 스크롤(맨 위 00 부터, 끝에서 멈춤)
pop.querySelectorAll(".pj-tp-col").forEach(function (c) {
const sel = c.querySelector(".is-selected");