From cdfeb07530929831735519b0faef3f9c19658029 Mon Sep 17 00:00:00 2001 From: Vitali Zaidman Date: Fri, 9 Oct 2026 00:08:27 -0700 Subject: [PATCH] Cmd+D often fails to open the React Native Dev Menu bottom sheet (#58946) Summary: Pull Request resolved: https://github.com/react/react-native/pull/58946 `RCTKeyCommands` ignored all registered key commands whenever any window had an active first responder (e.g. a focused `TextInput`), so Cmd+D intermittently failed to open the Dev Menu in the iOS Simulator / Mac Catalyst. Only unmodified key commands are now suppressed while a responder is active, so plain typing is still not intercepted while modifier shortcuts (Cmd+D, Cmd+R) fire reliably. Changelog: [iOS][Fixed] - Fix Cmd+D and other modifier key commands failing to open the Dev Menu when a view is the first responder Differential Revision: D114042042 --- packages/react-native/React/Base/RCTKeyCommands.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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]; } }