feat: 메뉴 열린 상태 단일 키 hotkey 항목 활성 인프라 (#792)#810
Conversation
메뉴 드롭다운 열린 상태에서 단일 키 입력 시 shortcutLabel 매칭하여 해당 항목의 커맨드를 디스패치. - modifier 없는 단일 문자 키만 매칭 (Ctrl/Alt/Shift/Meta 제외) - 대소문자 무시 (toUpperCase 비교) - disabled 항목 제외 - 매칭 성공 시 커맨드 실행 + 메뉴 닫기 적용 예: 표 메뉴 열린 상태에서 H → '셀 높이를 같게', W → '셀 너비를 같게' Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds keyboard handling to the MenuBar dropdown so that, while a menu is open, pressing a single non-modifier key can trigger the matching menu item based on its .md-shortcut label (case-insensitive), and Escape closes the menu. This implements the “menu-open single-key hotkey” infrastructure requested in #792 for table menu items like H/W.
Changes:
- Extend menu-open keydown handling from Escape-only to include single-key hotkey execution via
.md-shortcutmatching. - Filter out modifier-key combinations, non-single-character keys, and disabled items; dispatch the matched command and close the menu.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // 메뉴 열린 상태에서 단일 키 (modifier 없음) → shortcutLabel 매칭 | ||
| if (e.ctrlKey || e.altKey || e.metaKey || e.shiftKey) return; | ||
| if (e.key.length !== 1) return; | ||
| const key = e.key.toUpperCase(); |
| e.preventDefault(); | ||
| const cmd = (item as HTMLElement).dataset.cmd; | ||
| if (cmd) { | ||
| const params: Record<string, unknown> = { anchorEl: item }; | ||
| this.dispatcher.dispatch(cmd, params); | ||
| } |
클릭 경로와 동일하게 data-cmd 제외 data-* 속성을 params로 변환하여 커맨드에 전달하도록 수정. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@oksure — Issue #792 (PR #758 5/10 머지 영역 H/W shortcutLabel 도입 후 단축키 미동작 발견): 한컴 메뉴 hotkey (메뉴 열린 상태 영역 단일 키 영역 항목 활성) 인프라 정합. 본질 (2 commits, menu-bar.ts +26/-2): - setupKeyboardClose 영역 hotkey 매칭 추가 — 메뉴 열린 상태 영역 modifier 없는 단일 키 영역 .md-shortcut 텍스트 매칭 → 해당 .md-item dispatch + 메뉴 닫기 - Copilot 리뷰 반영 (3cdf7a6): hotkey 경로 영역 data-* params 전달 — 메뉴 클릭 경로 영역 동일 params 일관성 영역 좁힘 가드: - modifier 키 동반 시 무시 (전역 shortcut-map 충돌 방지) - 단일 문자 키만 (e.key.length === 1) - disabled 항목 제외 (:not(.disabled)) - 대소문자 무시 (.toUpperCase()) - 메뉴 닫힌 상태 early return (일반 텍스트 입력 영향 부재) - Escape 기존 동작 보존 자기 검증: tsc + cargo test ALL GREEN, WASM 재빌드 불필요 (TypeScript 단일) 시각 판정: 작업지시자 인터랙션 검증 ✅ 통과 (표 메뉴 H/W + 전역 단축키 회귀 부재) CI: ✅ Build & Test + CodeQL (js-ts/python/rust) + Canvas visual diff
|
@oksure 머지 완료 (commit 한컴 메뉴 hotkey 인프라 정합. modifier/length/disabled 3중 가드 영역 영역 전역 PR #758 (H/W shortcutLabel 도입) → 본 PR (메뉴 hotkey 인프라) 본질 정합 — feedback_pr_supersede_chain (c) 패턴. 자기 검증 tsc + cargo test ALL GREEN. 작업지시자 인터랙션 검증 통과 (표 메뉴 H/W + 메뉴 닫힌 상태 회귀 부재 + 전역 단축키 충돌 부재). 수고하셨습니다. |
- mydocs/pr/archives/pr_810_review.md (메뉴 hotkey 인프라 분석) - mydocs/pr/archives/pr_810_report.md (옵션 A 처리 결과 + 5중 가드) - mydocs/orders/20260511.md PR #810 행 추가
…im#810 후속 (5/11 orders 갱신) # Conflicts: # mydocs/orders/20260511.md
… 후속 (5/11 orders 갱신) # Conflicts: # mydocs/orders/20260511.md
변경 내용
메뉴 드롭다운 열린 상태에서 단일 키 입력 시
.md-shortcut텍스트와 매칭하여 해당 항목의 커맨드를 실행.동작
H키 입력shortcutLabel === 'H'매칭table:cell-height-equal) + 메뉴 닫기제약 조건
.key.length === 1)테스트
tsc --noEmit통과closes #792
감사합니다.