diff --git a/packages/react-native/React/Base/RCTKeyCommands.m b/packages/react-native/React/Base/RCTKeyCommands.m index 1e6e913ae995..13b49342331e 100644 --- a/packages/react-native/React/Base/RCTKeyCommands.m +++ b/packages/react-native/React/Base/RCTKeyCommands.m @@ -137,8 +137,13 @@ - (void)handleKeyUIEventSwizzle:(UIEvent *)event } } - // Ignore key commands (except escape) when there's an active responder - if (!firstResponder) { + // When there's an active responder, ignore key commands that don't use a + // shortcut modifier (Command/Control/Option) so that typing into a focused + // view (e.g. a text field) isn't intercepted. Shift and Caps Lock don't + // count here since they're part of normal text input. Commands with a + // shortcut modifier (e.g. Cmd+D to open the Dev Menu) should still fire. + UIKeyModifierFlags shortcutModifiers = UIKeyModifierCommand | UIKeyModifierControl | UIKeyModifierAlternate; + if (!firstResponder || (modifierFlags & shortcutModifiers) != 0) { [self RCT_handleKeyCommand:modifiedInput flags:modifierFlags]; } }