Skip to content

feat: 메뉴 열린 상태 단일 키 hotkey 항목 활성 인프라 (#792)#810

Closed
oksure wants to merge 2 commits into
edwardkim:develfrom
oksure:contrib/menu-hotkey-infra
Closed

feat: 메뉴 열린 상태 단일 키 hotkey 항목 활성 인프라 (#792)#810
oksure wants to merge 2 commits into
edwardkim:develfrom
oksure:contrib/menu-hotkey-infra

Conversation

@oksure

@oksure oksure commented May 11, 2026

Copy link
Copy Markdown
Contributor

변경 내용

메뉴 드롭다운 열린 상태에서 단일 키 입력 시 .md-shortcut 텍스트와 매칭하여 해당 항목의 커맨드를 실행.

동작

  1. 메뉴 열림 (예: 표 메뉴)
  2. 사용자 H 키 입력
  3. 열린 드롭다운의 활성 항목 중 shortcutLabel === 'H' 매칭
  4. 해당 커맨드 디스패치 (table:cell-height-equal) + 메뉴 닫기

제약 조건

  • modifier 키 (Ctrl/Alt/Shift/Meta) 동반 시 무시 — 전역 단축키와 충돌 방지
  • 단일 문자 키만 (.key.length === 1)
  • disabled 항목 제외
  • 대소문자 무시

테스트

  • TypeScript tsc --noEmit 통과

closes #792

감사합니다.

메뉴 드롭다운 열린 상태에서 단일 키 입력 시 shortcutLabel 매칭하여
해당 항목의 커맨드를 디스패치.

- modifier 없는 단일 문자 키만 매칭 (Ctrl/Alt/Shift/Meta 제외)
- 대소문자 무시 (toUpperCase 비교)
- disabled 항목 제외
- 매칭 성공 시 커맨드 실행 + 메뉴 닫기

적용 예: 표 메뉴 열린 상태에서 H → '셀 높이를 같게', W → '셀 너비를 같게'

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 11, 2026 04:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-shortcut matching.
  • 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.

Comment on lines +103 to +106
// 메뉴 열린 상태에서 단일 키 (modifier 없음) → shortcutLabel 매칭
if (e.ctrlKey || e.altKey || e.metaKey || e.shiftKey) return;
if (e.key.length !== 1) return;
const key = e.key.toUpperCase();
Comment on lines +111 to +116
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>
edwardkim added a commit that referenced this pull request May 11, 2026
@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
@edwardkim

Copy link
Copy Markdown
Owner

@oksure 머지 완료 (commit e1be8d9e).

한컴 메뉴 hotkey 인프라 정합. modifier/length/disabled 3중 가드 영역 영역 전역 shortcut-map.ts 충돌 부재. Copilot 리뷰 반영 (hotkey 경로 영역 data-* params 전달) 영역 클릭 경로 일관성 정합.

PR #758 (H/W shortcutLabel 도입) → 본 PR (메뉴 hotkey 인프라) 본질 정합 — feedback_pr_supersede_chain (c) 패턴.

자기 검증 tsc + cargo test ALL GREEN. 작업지시자 인터랙션 검증 통과 (표 메뉴 H/W + 메뉴 닫힌 상태 회귀 부재 + 전역 단축키 충돌 부재).

수고하셨습니다.

@edwardkim edwardkim closed this May 11, 2026
edwardkim added a commit that referenced this pull request May 11, 2026
- mydocs/pr/archives/pr_810_review.md (메뉴 hotkey 인프라 분석)
- mydocs/pr/archives/pr_810_report.md (옵션 A 처리 결과 + 5중 가드)
- mydocs/orders/20260511.md PR #810 행 추가
jangster77 added a commit to jangster77/rhwp that referenced this pull request May 11, 2026
…im#810 후속 (5/11 orders 갱신)

# Conflicts:
#	mydocs/orders/20260511.md
jangster77 added a commit to jangster77/rhwp that referenced this pull request May 11, 2026
… 후속 (5/11 orders 갱신)

# Conflicts:
#	mydocs/orders/20260511.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants