Skip to content

Commit c698485

Browse files
committed
fix(desktop): don't apply shift-to-symbol transformation for chord shortcuts
When Shift is combined with Control, Meta, or Alt, browsers report the base key (e.g. '1') rather than the shifted symbol (e.g. '!'). The resolveKeyDefinition function was unconditionally applying the shift transformation whenever Shift was present in modifiers, causing chord shortcuts like Ctrl+Shift+1 to emit '!' instead of '1' as the key in the CDP packet. Only apply the shift-to-symbol mapping for printable keys when Shift is the sole modifier, matching real browser KeyboardEvent behavior.
1 parent cfbdaf4 commit c698485

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

apps/desktop/src/preview/PreviewKeyboard.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ function resolveKeyDefinition(input: PreviewAutomationPressInput): KeyDefinition
114114
(definition) => definition.key === input.key || definition.shiftedKey === input.key,
115115
);
116116
if (printable) {
117-
const shifted = input.modifiers?.includes("Shift") ?? false;
117+
const hasNonShiftModifier = input.modifiers?.some((m) => m !== "Shift") ?? false;
118+
const shifted = !hasNonShiftModifier && (input.modifiers?.includes("Shift") ?? false);
118119
const key =
119120
printable.shiftedKey && (shifted || input.key === printable.shiftedKey)
120121
? printable.shiftedKey

0 commit comments

Comments
 (0)