Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

app: keybinds match the produced character, so Ctrl+F and other letter shortcuts fail on non-Latin layouts

Đang mở Phù hợp với người mới
#55,676 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@ZXLyyds100 đang làm issue này rồi.

Từ ngày 15/10/2026.

  • #55765 của @ZXLyyds100 — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
82/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
frontend

Hướng nghiên cứu

Bắt đầu từ packages/app/src/shell/commands/command.tsx, nơi có keyFromKeyboardEvent và matchKeybind, và đọc chúng cùng với các khai báo keybind trong cùng thư mục. Trên bố cục tiếng Nga, event.key là chữ Kirin còn event.code vẫn là KeyF, vì vậy hãy bỏ điều kiện !event.altKey để cơ chế dự phòng theo phím vật lý bao phủ Ctrl/Meta/Shift, sau đó ánh xạ các mã dấu câu (Comma, Period, Semicolon, Quote, BracketLeft, BracketRight, Backslash). Hoàn thành khi Ctrl+F mở thanh tìm kiếm trên bố cục không dùng chữ Latinh, các bind khác trong danh sách đều kích hoạt và các bài kiểm thử command hiện có đều xanh.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

reproduced
Description

App keybinds are matched against event.key (the character produced by the active
layout) and only fall back to the physical event.code when Alt is held. On
non-Latin layouts (e.g. Russian) event.key is Cyrillic, so letter and punctuation
shortcuts silently do nothing unless Alt is involved.

Example: the session find bar added in #48470 is bound to mod+f. On an English
layout Ctrl+F opens it; on a Russian layout it does nothing. session.search is
registered with hidden: true, so the command palette cannot reach it either — the
shortcut is the only entry point, and on a Cyrillic layout it never fires.

Root cause — packages/app/src/shell/commands/command.tsx:

export function keyFromKeyboardEvent(event: KeyboardEvent) {
  const key = normalizeKey(event.key)

  if (!event.altKey || /^[a-z0-9]$/.test(key)) return key

  if (!event.code.startsWith("Key") || event.code.length !== 4) return key

  return event.code.slice(3).toLowerCase()
}

matchKeybind compares the configured key ("f") with keyFromKeyboardEvent(event).
With a Russian layout, Ctrl+F arrives as event.key === "а", event.code === "KeyF",
event.altKey === false, so the function returns "а" and "f" !== "а" — no match.
Alt+F does match, so the event.code fallback exists but is gated on Alt (it was
added for macOS Option). Ctrl/Meta/Shift on a non-Latin layout are not covered.

The same applies to mod+p, mod+t, mod+w, mod+u, mod+shift+a/e/l/o/r/s/t/x,
mod+shift+d, and the punctuation binds mod+comma, mod+., mod+;, mod+',
mod+[, mod+], mod+\\. Digit binds (mod+1..9) are fine because the digit row
matches across these layouts.

Suggested fix: remove the !event.altKey gate so the physical-key fallback applies to
every modifier (this keeps the macOS Option behavior), and additionally map event.code
for the punctuation keys used in keybinds (Comma, Period, Semicolon, Quote,
BracketLeft, BracketRight, Backslash, …).

Related, but not the same:

  • #40048 — "Keybind Ctrl + . does not work with non-US keyboard layouts (e.g., Russian)"
    — identical root cause, auto-closed by the stale bot, not fixed.
  • #6364 — "Hotkeys don't work if the keyboard layout isn't english" — same, auto-closed.
  • #54708 — handles Dead/Unidentified keys; here event.key is a valid character, so
    that fallback does not trigger.
  • #55371 — open, but the TUI (terminal input / Kitty protocol); the app path is separate.
Plugins

None

OpenCode version

2.0.29 (desktop app)

Steps to reproduce
  1. Open the desktop app on Windows and switch the keyboard layout to Russian (ЙЦУКЕН).
  2. Open a session and press Ctrl+F on the physical F key. → Nothing happens.
  3. Switch to the English layout and press the same physical keys. → The find bar opens.
  4. Still in the Russian layout, Alt+F matches while Ctrl+F does not.
Screenshot and/or share link

N/A

Operating System

Windows 11 (10.0.22631)

Terminal

N/A — desktop app

Ngôn ngữ chính
TypeScript
Star
213k
Fork
28.4k
Merge trung bình
8 giờ 58 phút
Pull request đã merge (30 ngày)
251

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của anomalyco/opencode

Tất cả issue của anomalyco/opencode

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.