Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ function BaseSelectionListWithSections<TItem extends ListItem>({

useKeyboardShortcut(CONST.KEYBOARD_SHORTCUTS.ENTER, selectFocusedItem, {
captureOnInputs: true,
shouldBubble: !getFocusedItem(),
shouldBubble: itemsCount > 0 && !getFocusedItem(),
shouldStopPropagation,
Comment on lines 187 to 190

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Allow Enter to bubble when list is empty

When filtering drives itemsCount to 0, useSearchFocusSync early‑returns on data.length === 0, so focusedIndex can remain ≥0 while getFocusedItem() returns undefined. With the new itemsCount > 0 guard, shouldBubble becomes false in that state, so the Enter handler stays active but blocks lower‑priority keyboard shortcuts (e.g., modal confirm or parent submit handlers) and Enter/Ctrl+Enter becomes a no‑op when the list is empty. This is a regression from the previous !getFocusedItem() behavior, which allowed bubbling in the empty‑list case.

Useful? React with 👍 / 👎.

isActive: !disableKeyboardShortcuts && isScreenFocused && focusedIndex >= 0 && !disableEnterShortcut,
});
Expand All @@ -203,7 +203,7 @@ function BaseSelectionListWithSections<TItem extends ListItem>({
},
{
captureOnInputs: true,
shouldBubble: !getFocusedItem(),
shouldBubble: itemsCount > 0 && !getFocusedItem(),
isActive: !disableKeyboardShortcuts && isScreenFocused && !confirmButtonOptions?.isDisabled,
},
);
Expand Down
Loading