mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-28 10:12:11 +00:00
[fix] Change keyboard event handling from event.key to event.code
This fixes keyboard shortcuts not working on non-English (non-Latin) keyboard layouts. Changes: - KeyComboImpl.fromEvent() now uses event.code instead of event.key - Updated isModifier check to use key codes for modifier keys - Added getDisplayKey() method to convert key codes to readable names - Updated Escape key handling in keybindingService to use event.code - Updated KeybindingPanel captureKeybinding to use event.code - Migrated all core keybindings from event.key to event.code format - Fixed tests to mock event.code instead of event.key Fixes #5252 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -66,7 +66,7 @@ describe('keybindingService - Escape key handling', () => {
|
||||
|
||||
it('should execute ExitSubgraph command when Escape is pressed', async () => {
|
||||
const event = new KeyboardEvent('keydown', {
|
||||
key: 'Escape',
|
||||
code: 'Escape',
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
})
|
||||
@@ -83,7 +83,7 @@ describe('keybindingService - Escape key handling', () => {
|
||||
|
||||
it('should not execute command when Escape is pressed with modifiers', async () => {
|
||||
const event = new KeyboardEvent('keydown', {
|
||||
key: 'Escape',
|
||||
code: 'Escape',
|
||||
ctrlKey: true,
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
@@ -100,7 +100,7 @@ describe('keybindingService - Escape key handling', () => {
|
||||
it('should not execute command when typing in input field', async () => {
|
||||
const inputElement = document.createElement('input')
|
||||
const event = new KeyboardEvent('keydown', {
|
||||
key: 'Escape',
|
||||
code: 'Escape',
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
})
|
||||
@@ -130,7 +130,7 @@ describe('keybindingService - Escape key handling', () => {
|
||||
document.body.appendChild(dialog)
|
||||
|
||||
const event = new KeyboardEvent('keydown', {
|
||||
key: 'Escape',
|
||||
code: 'Escape',
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
})
|
||||
@@ -158,7 +158,7 @@ describe('keybindingService - Escape key handling', () => {
|
||||
)
|
||||
|
||||
const event = new KeyboardEvent('keydown', {
|
||||
key: 'Escape',
|
||||
code: 'Escape',
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
})
|
||||
@@ -185,7 +185,7 @@ describe('keybindingService - Escape key handling', () => {
|
||||
keybindingService = useKeybindingService()
|
||||
|
||||
const event = new KeyboardEvent('keydown', {
|
||||
key: 'Escape',
|
||||
code: 'Escape',
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user