fix(spreadsheet): 메뉴 동작 뒤 초점 격자로 · 펼친 하위 메뉴가 화면 밖이면 올림(81-3)

- keepGridFocus — 항목을 누른 뒤 초점이 문서로 빠지면 격자 입력칸으로(Ctrl+Z 등 키가 바로 먹음)
- ui_template_context_menu — 하위(▸)를 펼칠 때도 화면 안으로 당김(fit 한 곳)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UoSr2sqvYtBf1dtQdus88s
This commit is contained in:
2026-10-08 13:36:18 +09:00
co-authored by Claude Opus 5.5
parent ea84957927
commit 9c510b57b1
3 changed files with 28 additions and 7 deletions
@@ -83,6 +83,18 @@ function back(ctx: SpreadsheetContext): void {
(ctx.editor as Editor).focus?.();
}
/** 항목을 누른 뒤 초점이 문서(body)에 떨어졌으면 격자로 — 창을 띄운 동작은 그 창이 초점을 가짐 */
export function keepGridFocus(ctx: SpreadsheetContext, menuRoot: HTMLElement): void {
menuRoot.addEventListener(
"click",
() =>
setTimeout(() => {
if (document.activeElement === document.body) back(ctx);
}),
true,
);
}
/** 잘라내기 · 복사 — 초점을 격자로 되돌린 뒤 불러야 부품의 copy · cut 듣기가 받음(빈 복사 막음) */
export function copyCut(ctx: SpreadsheetContext, kind: "cut" | "copy"): void {
back(ctx);