Hi Blitz team! 👋
First of all, thank you so much for building such an amazing project and native renderer for Dioxus!
While testing text inputs on macOS, I noticed a few unexpected behaviors regarding keyboard navigation, shortcuts, and clipboard operations.
Describe the bug
-
Duplicate cursor movement on plain arrow keys:
Pressing ArrowLeft or ArrowRight moves the cursor by 2 characters instead of 1. Similarly, Shift + Arrow selects 2 characters at once.
-
Cmd + Arrow line/document navigation does not work:
Pressing standard macOS navigation shortcuts such as Cmd + Left/Right (jump to line start/end) or Cmd + Up/Down (jump to text start/end) does not move the cursor at all.
-
Cmd + Backspace does not delete to line start:
On macOS, Cmd + Backspace is expected to delete all characters from the cursor to the beginning of the line, but it does nothing.
-
Clipboard actions (Cmd + C, Cmd + V, Cmd + X) are not handled in AppleStandardKeyBinding:
apply_apple_standard_keybinding does not handle copy:, cut:, and paste: selectors.
-
Typo in moveToEndOfDocumentAndModifySelection::
In apply_apple_standard_keybinding, the "moveToEndOfDocumentAndModifySelection:" branch calls driver.move_to_text_end() instead of driver.select_to_text_end().
-
Action shortcuts (Cmd + A / C / V / X) fail on non-Latin keyboard layouts:
In apply_keypress_event and handle_key_or_input_event, shortcuts were matched solely against Key::Character("a" | "c" | "v" | "x"). On non-Latin layouts (e.g., Korean 2-Set where physical KeyC generates ㅊ), logical_key is non-ASCII, causing all shortcuts to fail completely. Shortcuts should prioritize physical key codes (Code::Key*) as standard OS conventions dictate.
Root Cause & Architecture (Referencing VS Code and Zed's Pattern)
I looked into how VS Code and Zed design and handle platform-specific keyboard shortcuts on macOS:
- Why
Cmd + Arrow is ignored: macOS AppKit's interpretKeyEvents: treats Option + arrows as text selectors (moveWordLeft:), but ignores the Command modifier for standard text input (treating it as application menu commands). As a result, winit never receives standard selectors for Cmd keystrokes and only emits raw KeyPress events with SUPER.
- The double movement: Plain arrow keys are emitted both as
AppleStandardKeyBinding("moveLeft:") and KeyPress(ArrowLeft).
- Physical Key Mapping for Shortcuts: Both macOS system conventions and editors like Zed map action shortcuts based on physical key positions (or command layout mapping) rather than layout-specific character glyphs.
- Following this pattern in
blitz-dom: Plain/Option arrows are left to AppleStandardKeyBinding to avoid double movement, while Cmd + Arrow, Cmd + Backspace, and physical-key-mapped Cmd + A / C / V / X are cleanly handled in apply_keypress_event.
Expected Behavior
- Plain
ArrowLeft / ArrowRight moves cursor by exactly 1 character.
Option + ArrowLeft/Right jumps by word (delegated to AppKit's moveWordLeft:).
Cmd + ArrowLeft/Right moves cursor to line start/end (and with Shift, expands selection).
Cmd + ArrowUp/Down moves cursor to document start/end (and with Shift, expands selection).
Cmd + Backspace deletes from cursor to line start.
Cmd + A / C / V / X operate reliably across all keyboard layouts (including Korean, Cyrillic, etc.).
Environment
- OS: macOS
- Crate:
blitz-dom (packages/blitz-dom/src/node/text.rs, events/keyboard.rs, util.rs)
Additional Note
I already have a tested and verified fix ready for this issue (following the VS Code and Zed patterns) and submitted PR #895!
Also, as I'm actively building with and testing Blitz, I'd love to continue contributing by submitting issues and PRs whenever I find bugs or potential improvements. Would that be welcome?
Thanks again for the great work!
Hi Blitz team! 👋
First of all, thank you so much for building such an amazing project and native renderer for Dioxus!
While testing text inputs on macOS, I noticed a few unexpected behaviors regarding keyboard navigation, shortcuts, and clipboard operations.
Describe the bug
Duplicate cursor movement on plain arrow keys:
Pressing
ArrowLeftorArrowRightmoves the cursor by 2 characters instead of 1. Similarly,Shift + Arrowselects 2 characters at once.Cmd + Arrowline/document navigation does not work:Pressing standard macOS navigation shortcuts such as
Cmd + Left/Right(jump to line start/end) orCmd + Up/Down(jump to text start/end) does not move the cursor at all.Cmd + Backspacedoes not delete to line start:On macOS,
Cmd + Backspaceis expected to delete all characters from the cursor to the beginning of the line, but it does nothing.Clipboard actions (
Cmd + C,Cmd + V,Cmd + X) are not handled inAppleStandardKeyBinding:apply_apple_standard_keybindingdoes not handlecopy:,cut:, andpaste:selectors.Typo in
moveToEndOfDocumentAndModifySelection::In
apply_apple_standard_keybinding, the"moveToEndOfDocumentAndModifySelection:"branch callsdriver.move_to_text_end()instead ofdriver.select_to_text_end().Action shortcuts (
Cmd + A / C / V / X) fail on non-Latin keyboard layouts:In
apply_keypress_eventandhandle_key_or_input_event, shortcuts were matched solely againstKey::Character("a" | "c" | "v" | "x"). On non-Latin layouts (e.g., Korean 2-Set where physicalKeyCgeneratesㅊ),logical_keyis non-ASCII, causing all shortcuts to fail completely. Shortcuts should prioritize physical key codes (Code::Key*) as standard OS conventions dictate.Root Cause & Architecture (Referencing VS Code and Zed's Pattern)
I looked into how VS Code and Zed design and handle platform-specific keyboard shortcuts on macOS:
Cmd + Arrowis ignored: macOS AppKit'sinterpretKeyEvents:treatsOption+ arrows as text selectors (moveWordLeft:), but ignores theCommandmodifier for standard text input (treating it as application menu commands). As a result,winitnever receives standard selectors forCmdkeystrokes and only emits rawKeyPressevents withSUPER.AppleStandardKeyBinding("moveLeft:")andKeyPress(ArrowLeft).blitz-dom: Plain/Option arrows are left toAppleStandardKeyBindingto avoid double movement, whileCmd + Arrow,Cmd + Backspace, and physical-key-mappedCmd + A / C / V / Xare cleanly handled inapply_keypress_event.Expected Behavior
ArrowLeft/ArrowRightmoves cursor by exactly 1 character.Option + ArrowLeft/Rightjumps by word (delegated to AppKit'smoveWordLeft:).Cmd + ArrowLeft/Rightmoves cursor to line start/end (and withShift, expands selection).Cmd + ArrowUp/Downmoves cursor to document start/end (and withShift, expands selection).Cmd + Backspacedeletes from cursor to line start.Cmd + A / C / V / Xoperate reliably across all keyboard layouts (including Korean, Cyrillic, etc.).Environment
blitz-dom(packages/blitz-dom/src/node/text.rs,events/keyboard.rs,util.rs)Additional Note
I already have a tested and verified fix ready for this issue (following the VS Code and Zed patterns) and submitted PR #895!
Also, as I'm actively building with and testing Blitz, I'd love to continue contributing by submitting issues and PRs whenever I find bugs or potential improvements. Would that be welcome?
Thanks again for the great work!