-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Bug: REDO_COMMAND not triggered with non-English keyboard layouts (Ctrl+Y / Ctrl+Shift+Z) #8147
Copy link
Copy link
Closed
Labels
coreReconciler, DOM, Selection, Node, Events, CompositionReconciler, DOM, Selection, Node, Events, Composition
Description
Lexical version: 0.40.0
Steps To Reproduce
- OS: Windows 10 (22H2), Windows 11 (24H2), Ubuntu 22.04.5 LTS / Browser: Google Chrome 140.0.7339.127, Google Chrome 144.0.7559.133, Firefox Developer Edition 148.0b15
- Set English and another keyboard layout in the OS (for example, English (US) and Russian (RU)).
- Enter any text into the lexical input field so that a
historyUndoaction becomes available. - Press the keyboard shortcut (Ctrl+Z) to trigger the
historyUndonative browser event. - Press the keyboard shortcut (Ctrl+Y or Ctrl+Shift+Z) to trigger the
historyRedonative browser event.
Link to code example: https://playground.lexical.dev
The current behavior
- lexical.js does NOT trigger
REDO_COMMANDbecause the nativehistoryRedoevent is not fired. - lexical.js does NOT trigger
REDO_COMMANDbecause theevent.keyequals to "я" not "z", but it is same physical key button in the keyboard. - lexical.js detects keyboard shortcuts based on
event.keyinstead ofevent.code(https://github.com/facebook/lexical/blob/main/packages/lexical/src/LexicalUtils.ts#L990). - The browser menu is not aware of Lexical’s history stack and therefore disables the “Redo” option (I suspect there are browser restrictions).
- My screencast: https://github.com/user-attachments/assets/3e086e9d-95df-4940-84ec-ccb561a5d0bd
The expected behavior
- lexical.js should process
REDO_COMMANDwhen Ctrl+Y or Ctrl+Shift+Z is pressed (with any non-English keyboard layout). - lexical.js should determine all shortcuts using
event.codeby default (https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code#examples).
Impact of fix
- Affects all users who are not using an English keyboard layout.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
coreReconciler, DOM, Selection, Node, Events, CompositionReconciler, DOM, Selection, Node, Events, Composition