From 047fcba3b9df3fd6159832b9b7aa20ba27c7d8b1 Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Mon, 12 Aug 2024 18:56:49 -0600 Subject: [PATCH] Merge pull request #47244 from Krishna2323/krishna2323/issue/47230 [CP Staging] fix: Report fields - App crashes when disabling/enabling list values via checkbox & dropdown button. (cherry picked from commit 8cf898d2b3f3897bcd71bee16a34af84e4ca22e8) (CP triggered by Beamanator) --- src/components/ButtonWithDropdownMenu/index.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/ButtonWithDropdownMenu/index.tsx b/src/components/ButtonWithDropdownMenu/index.tsx index 1eeadde84c47..943d6dbb5c16 100644 --- a/src/components/ButtonWithDropdownMenu/index.tsx +++ b/src/components/ButtonWithDropdownMenu/index.tsx @@ -78,7 +78,15 @@ function ButtonWithDropdownMenu({ useKeyboardShortcut( CONST.KEYBOARD_SHORTCUTS.CTRL_ENTER, (e) => { - onPress(e, selectedItem.value); + if (shouldAlwaysShowDropdownMenu || options.length) { + if (!isSplitButton) { + setIsMenuVisible(!isMenuVisible); + return; + } + onPress(e, selectedItem?.value); + } else { + onPress(e, options[0]?.value); + } }, { captureOnInputs: true,